Skip to content

Commit ee930d5

Browse files
timoteoponceEugen
authored andcommitted
BAEL-1696 Initial setup in a workable state (eugenp#4173)
* BAEL-1696 Initial setup in a workable state * Fixed method name on tomcatController
1 parent 02d2a46 commit ee930d5

6 files changed

Lines changed: 106 additions & 1 deletion

File tree

‎pom.xml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
<module>spring-boot-keycloak</module>
142142
<module>spring-boot-bootstrap</module>
143143
<module>spring-boot-admin</module>
144+
<module>spring-boot-tomcat</module>
144145
<module>spring-boot-security</module>
145146
<module>spring-cloud-data-flow</module>
146147
<module>spring-cloud</module>
@@ -530,4 +531,4 @@
530531
<junit.jupiter.version>5.0.2</junit.jupiter.version>
531532
</properties>
532533

533-
</project>
534+
</project>

‎spring-boot-tomcat/pom.xml‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.baeldung</groupId>
7+
<artifactId>spring-boot-tomcat</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>war</packaging>
10+
11+
<name>spring-boot-tomcat</name>
12+
<description>Demo project for Spring Boot and Tomcat setup</description>
13+
14+
<parent>
15+
<groupId>org.springframework.boot</groupId>
16+
<artifactId>spring-boot-starter-parent</artifactId>
17+
<version>2.0.1.RELEASE</version>
18+
<relativePath/> <!-- lookup parent from repository -->
19+
</parent>
20+
21+
<properties>
22+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24+
<java.version>1.8</java.version>
25+
</properties>
26+
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-starter-web</artifactId>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-tomcat</artifactId>
36+
<scope>provided</scope>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter-test</artifactId>
42+
<scope>test</scope>
43+
</dependency>
44+
</dependencies>
45+
46+
<build>
47+
<finalName>${artifactId}</finalName>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-maven-plugin</artifactId>
52+
</plugin>
53+
</plugins>
54+
</build>
55+
56+
57+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.baeldung.springbootsimple;
2+
3+
import org.springframework.boot.*;
4+
import org.springframework.boot.autoconfigure.*;
5+
import org.springframework.boot.web.servlet.support.*;
6+
7+
@SpringBootApplication
8+
public class SpringBootTomcatApplication extends SpringBootServletInitializer {
9+
10+
public static void main(String[] args) {
11+
SpringApplication.run(SpringBootTomcatApplication.class, args);
12+
}
13+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.baeldung.springbootsimple;
2+
3+
import org.springframework.web.bind.annotation.*;
4+
5+
import java.util.*;
6+
import java.util.stream.*;
7+
8+
@RestController
9+
public class TomcatController {
10+
11+
@GetMapping(value = "/hello")
12+
public Collection<String> sayHello() {
13+
return IntStream.range(0, 10)
14+
.mapToObj(i -> "Hello number " + i)
15+
.collect(Collectors.toList());
16+
}
17+
18+
}

‎spring-boot-tomcat/src/main/resources/application.properties‎

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.baeldung.springbootsimple;
2+
3+
import org.junit.Test;
4+
import org.junit.runner.RunWith;
5+
import org.springframework.boot.test.context.SpringBootTest;
6+
import org.springframework.test.context.junit4.SpringRunner;
7+
8+
@RunWith(SpringRunner.class)
9+
@SpringBootTest
10+
public class SpringBootTomcatApplicationTests {
11+
12+
@Test
13+
public void contextLoads() {
14+
}
15+
16+
}

0 commit comments

Comments
 (0)