Skip to content

Commit

Permalink
formatting work
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenp committed Jul 23, 2015
1 parent 6c6cc61 commit 5dcca02
Show file tree
Hide file tree
Showing 46 changed files with 97 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;


public class BeanWithCreator {
public int id;
public String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ public Zoo(final Animal animal) {
this.animal = animal;
}


@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "dog"),
@JsonSubTypes.Type(value = Cat.class, name = "cat")
})
@JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "dog"), @JsonSubTypes.Type(value = Cat.class, name = "cat") })
public static class Animal {
public String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;


public class JacksonAnnotationTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public final void givenJsonHasUnknownValues_whenDeserializingAJsonToAClass_thenE

@Test
public final void givenJsonHasUnknownValuesButJacksonIsIgnoringUnknownFields_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException {
final String jsonAsString =// @formatter:off
final String jsonAsString = // @formatter:off
"{\"stringValue\":\"a\"," +
"\"intValue\":1," +
"\"booleanValue\":true," +
Expand All @@ -84,7 +84,7 @@ public final void givenJsonHasUnknownValuesButJacksonIsIgnoringUnknownFields_whe

@Test
public final void givenJsonHasUnknownValuesButUnknownFieldsAreIgnoredOnClass_whenDeserializing_thenCorrect() throws JsonParseException, JsonMappingException, IOException {
final String jsonAsString =// @formatter:off
final String jsonAsString = // @formatter:off
"{\"stringValue\":\"a\"," +
"\"intValue\":1," +
"\"booleanValue\":true," +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({// @formatter:off
@Suite.SuiteClasses({ // @formatter:off
JacksonCollectionDeserializationUnitTest.class
,JacksonSerializationEnumsUnitTest.class
,JacksonDeserializationUnitTest.class
Expand Down
2 changes: 1 addition & 1 deletion spring-all/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="owner.project.facets" value="java"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down
1 change: 1 addition & 0 deletions spring-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
</dependency>

<!-- validation -->

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class ChildValueHolder {
@Value("${child.name:-}")
private String childName;


public String getParentName() {
return parentName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class ParentValueHolder {
@Value("${child.name:-}")
private String childName;


public String getParentName() {
return parentName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({//@formatter:off
@SuiteClasses({ //@formatter:off
PropertiesWithXmlIntegrationTest.class,
ExternalPropertiesWithJavaIntegrationTest.class,
ExternalPropertiesWithMultipleXmlsIntegrationTest.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import org.springframework.web.bind.annotation.RequestMapping;

public class MyCustomErrorController implements ErrorController {

private static final String PATH = "/error";

public MyCustomErrorController() {
// TODO Auto-generated constructor stub
}
@RequestMapping(value=PATH)

@RequestMapping(value = PATH)
public String error() {
return "Error heaven";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ public class ErrorController {

public ErrorController() {
}

@RequestMapping("/400")
String error400() {
return "Error Code: 400 occured.";
}

@RequestMapping("/errorHeaven")
String errorHeaven() {
return "You have reached the heaven of errors!!!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public MyServletContainerCustomizationBean() {
public void customize(ConfigurableEmbeddedServletContainer container) {
container.setPort(8084);
container.setContextPath("/springbootapp");

container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400"));
container.addErrorPages(new ErrorPage("/errorHeaven"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import org.springframework.boot.ExitCodeGenerator;

public class ExecutorServiceExitCodeGenerator implements ExitCodeGenerator {

private ExecutorService executorService;

public ExecutorServiceExitCodeGenerator(ExecutorService executorService) {
}

Expand All @@ -20,8 +20,7 @@ public int getExitCode() {
executorService.shutdownNow();
returnCode = 1;
}
}
catch (SecurityException ex) {
} catch (SecurityException ex) {
returnCode = 0;
}
return returnCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,32 @@
import javax.servlet.http.HttpServletResponse;

public class HelloWorldServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;

public HelloWorldServlet() {
super();
}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = null;
try {
out = response.getWriter();
out.println("HelloWorldServlet: GET METHOD");
out.flush();
}
finally {
if (!Objects.isNull(out))
} finally {
if (!Objects.isNull(out))
out.close();
}
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = null;
try {
out = response.getWriter();
out.println("HelloWorldServlet: POST METHOD");
out.flush();
}
finally {
if (!Objects.isNull(out))
} finally {
if (!Objects.isNull(out))
out.close();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import javax.servlet.http.HttpServletResponse;

public class SpringHelloWorldServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;

public SpringHelloWorldServlet() {
super();
}
Expand All @@ -22,9 +22,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
out = response.getWriter();
out.println("SpringHelloWorldServlet: GET METHOD");
out.flush();
}
finally {
if (!Objects.isNull(out))
} finally {
if (!Objects.isNull(out))
out.close();
}
}
Expand All @@ -35,9 +34,8 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
out = response.getWriter();
out.println("SpringHelloWorldServlet: POST METHOD");
out.flush();
}
finally {
if (!Objects.isNull(out))
} finally {
if (!Objects.isNull(out))
out.close();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@

@RestController
@EnableAutoConfiguration
@ComponentScan({ "org.baeldung.common.error", "org.baeldung.common.error.controller",
"org.baeldung.common.properties", "org.baeldung.common.resources", "org.baeldung.endpoints",
"org.baeldung.service", "org.baeldung.monitor.jmx", "org.baeldung.service"})
@ComponentScan({ "org.baeldung.common.error", "org.baeldung.common.error.controller", "org.baeldung.common.properties", "org.baeldung.common.resources", "org.baeldung.endpoints", "org.baeldung.service", "org.baeldung.monitor.jmx", "org.baeldung.service" })
public class SpringBootApplication {

private static ApplicationContext applicationContext;

@Autowired
private LoginService service;

Expand All @@ -34,57 +32,57 @@ String home() {
service.login("admin", "admin".toCharArray());
return "TADA!!! You are in Spring Boot Actuator test application.";
}

public static void main(String[] args) {
applicationContext = SpringApplication.run(SpringBootApplication.class, args);
}

@Bean
public ExecutorService executorService() {
return Executors.newFixedThreadPool(10);
return Executors.newFixedThreadPool(10);
}

@Bean
public HelloWorldServlet helloWorldServlet() {
return new HelloWorldServlet();
}

@Bean
public SpringHelloServletRegistrationBean servletRegistrationBean() {
SpringHelloServletRegistrationBean bean = new SpringHelloServletRegistrationBean(new SpringHelloWorldServlet(), "/springHelloWorld/*");
bean.setLoadOnStartup(1);
bean.addInitParameter("message", "SpringHelloWorldServlet special message");
return bean;
}
/* @Bean

/* @Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
JettyEmbeddedServletContainerFactory jettyContainer = new JettyEmbeddedServletContainerFactory();
jettyContainer.setPort(9000);
jettyContainer.setContextPath("/springbootapp");
return jettyContainer;
}
@Bean
public UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() {
UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
factory.addBuilderCustomizers(new UndertowBuilderCustomizer() {
@Override
public void customize(io.undertow.Undertow.Builde builder) {
builder.addHttpListener(8080, "0.0.0.0");
}
});
return factory;
}*/
@Bean

@Bean
@Autowired
public ExecutorServiceExitCodeGenerator executorServiceExitCodeGenerator(ExecutorService executorService) {
return new ExecutorServiceExitCodeGenerator(executorService);
}

public void shutDown(ExecutorServiceExitCodeGenerator executorServiceExitCodeGenerator) {
SpringApplication.exit(applicationContext, executorServiceExitCodeGenerator);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.stereotype.Repository;

@Repository
public class ChildDao extends AbstractHibernateDao<Child> implements IChildDao {
public class ChildDao extends AbstractHibernateDao<Child>implements IChildDao {

@Autowired
private SessionFactory sessionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.stereotype.Repository;

@Repository
public class FooDao extends AbstractHibernateDao<Foo> implements IFooDao {
public class FooDao extends AbstractHibernateDao<Foo>implements IFooDao {

@Autowired
private SessionFactory sessionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.stereotype.Repository;

@Repository
public class ParentDao extends AbstractHibernateDao<Parent> implements IParentDao {
public class ParentDao extends AbstractHibernateDao<Parent>implements IParentDao {

@Autowired
private SessionFactory sessionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.stereotype.Service;

@Service
public class ChildService extends AbstractService<Child> implements IChildService {
public class ChildService extends AbstractService<Child>implements IChildService {

@Autowired
private IChildDao dao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.stereotype.Service;

@Service
public class FooService extends AbstractService<Foo> implements IFooService {
public class FooService extends AbstractService<Foo>implements IFooService {

@Autowired
private IFooDao dao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.stereotype.Service;

@Service
public class ParentService extends AbstractService<Parent> implements IParentService {
public class ParentService extends AbstractService<Parent>implements IParentService {

@Autowired
private IParentDao dao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({// @formatter:off
@Suite.SuiteClasses({ // @formatter:off
Cause1BeanCreationExceptionIntegrationTest.class
,Cause2BeanCreationExceptionIntegrationTest.class
,Cause3BeanCreationExceptionIntegrationTest.class
Expand Down
Loading

0 comments on commit 5dcca02

Please sign in to comment.