diff --git a/pom.xml b/pom.xml index fb098a1eb3..a73d7ed357 100644 --- a/pom.xml +++ b/pom.xml @@ -141,6 +141,7 @@ spring-boot-keycloak spring-boot-bootstrap spring-boot-admin + spring-boot-tomcat spring-boot-security spring-cloud-data-flow spring-cloud @@ -530,4 +531,4 @@ 5.0.2 - \ No newline at end of file + diff --git a/spring-boot-tomcat/pom.xml b/spring-boot-tomcat/pom.xml new file mode 100644 index 0000000000..29c8ce95d6 --- /dev/null +++ b/spring-boot-tomcat/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + com.baeldung + spring-boot-tomcat + 0.0.1-SNAPSHOT + war + + spring-boot-tomcat + Demo project for Spring Boot and Tomcat setup + + + org.springframework.boot + spring-boot-starter-parent + 2.0.1.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + ${artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-boot-tomcat/src/main/java/com/baeldung/springbootsimple/SpringBootTomcatApplication.java b/spring-boot-tomcat/src/main/java/com/baeldung/springbootsimple/SpringBootTomcatApplication.java new file mode 100644 index 0000000000..c9f90683ec --- /dev/null +++ b/spring-boot-tomcat/src/main/java/com/baeldung/springbootsimple/SpringBootTomcatApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.springbootsimple; + +import org.springframework.boot.*; +import org.springframework.boot.autoconfigure.*; +import org.springframework.boot.web.servlet.support.*; + +@SpringBootApplication +public class SpringBootTomcatApplication extends SpringBootServletInitializer { + + public static void main(String[] args) { + SpringApplication.run(SpringBootTomcatApplication.class, args); + } +} diff --git a/spring-boot-tomcat/src/main/java/com/baeldung/springbootsimple/TomcatController.java b/spring-boot-tomcat/src/main/java/com/baeldung/springbootsimple/TomcatController.java new file mode 100644 index 0000000000..fcf7ecd6c0 --- /dev/null +++ b/spring-boot-tomcat/src/main/java/com/baeldung/springbootsimple/TomcatController.java @@ -0,0 +1,18 @@ +package com.baeldung.springbootsimple; + +import org.springframework.web.bind.annotation.*; + +import java.util.*; +import java.util.stream.*; + +@RestController +public class TomcatController { + + @GetMapping(value = "/hello") + public Collection sayHello() { + return IntStream.range(0, 10) + .mapToObj(i -> "Hello number " + i) + .collect(Collectors.toList()); + } + +} diff --git a/spring-boot-tomcat/src/main/resources/application.properties b/spring-boot-tomcat/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot-tomcat/src/test/java/com/baeldung/springbootsimple/SpringBootTomcatApplicationTests.java b/spring-boot-tomcat/src/test/java/com/baeldung/springbootsimple/SpringBootTomcatApplicationTests.java new file mode 100644 index 0000000000..4c0d4d577a --- /dev/null +++ b/spring-boot-tomcat/src/test/java/com/baeldung/springbootsimple/SpringBootTomcatApplicationTests.java @@ -0,0 +1,16 @@ +package com.baeldung.springbootsimple; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootTomcatApplicationTests { + + @Test + public void contextLoads() { + } + +}