Fix broken merge

This commit is contained in:
coach88
2015-07-31 13:15:52 +03:00
parent 7ad6ba42a4
commit a292a07cfc
132 changed files with 5257 additions and 5326 deletions
+59 -76
View File
@@ -1,90 +1,73 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId>
<artifactId>spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Spring Boot Actuator</name>
<description>This is simple boot application for Spring boot actuator test</description>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId>
<artifactId>spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Spring Boot Actuator</name>
<description>This is simple boot application for Spring boot actuator test</description>
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
</parent>
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions> -->
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency> -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
</dependencies>
<build>
<finalName>spring-boot</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<build>
<finalName>spring-boot</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
</plugins>
</plugins>
</build>
</build>
</project>
@@ -4,14 +4,14 @@ import org.springframework.boot.autoconfigure.web.ErrorController;
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";
}
@@ -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!!!";
@@ -17,7 +17,7 @@ public class MyServletContainerCustomizationBean implements EmbeddedServletConta
public void customize(ConfigurableEmbeddedServletContainer container) {
container.setPort(8084);
container.setContextPath("/springbootapp");
container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400"));
container.addErrorPages(new ErrorPage("/errorHeaven"));
}
@@ -6,9 +6,9 @@ import java.util.concurrent.ExecutorService;
import org.springframework.boot.ExitCodeGenerator;
public class ExecutorServiceExitCodeGenerator implements ExitCodeGenerator {
private ExecutorService executorService;
public ExecutorServiceExitCodeGenerator(ExecutorService executorService) {
}
@@ -20,8 +20,7 @@ public class ExecutorServiceExitCodeGenerator implements ExitCodeGenerator {
executorService.shutdownNow();
returnCode = 1;
}
}
catch (SecurityException ex) {
} catch (SecurityException ex) {
returnCode = 0;
}
return returnCode;
@@ -10,34 +10,32 @@ import javax.servlet.http.HttpServletRequest;
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();
}
}
@@ -10,8 +10,8 @@ import javax.servlet.http.HttpServletRequest;
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();
}
@@ -22,9 +22,8 @@ public class SpringHelloWorldServlet extends HttpServlet {
out = response.getWriter();
out.println("SpringHelloWorldServlet: GET METHOD");
out.flush();
}
finally {
if (!Objects.isNull(out))
} finally {
if (!Objects.isNull(out))
out.close();
}
}
@@ -35,9 +34,8 @@ public class SpringHelloWorldServlet extends HttpServlet {
out = response.getWriter();
out.println("SpringHelloWorldServlet: POST METHOD");
out.flush();
}
finally {
if (!Objects.isNull(out))
} finally {
if (!Objects.isNull(out))
out.close();
}
}
@@ -19,13 +19,11 @@ import org.springframework.web.bind.annotation.RestController;
@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;
@@ -34,21 +32,21 @@ public class SpringBootApplication {
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/*");
@@ -56,35 +54,35 @@ public class SpringBootApplication {
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);
}