Skip to content

Commit 5dcc72e

Browse files
committed
Initial commit
0 parents  commit 5dcc72e

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

pom.xml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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>org.springframework</groupId>
7+
<artifactId>hello-java</artifactId>
8+
<version>0.1.0</version>
9+
<packaging>war</packaging>
10+
11+
<parent>
12+
<groupId>org.springframework.boot</groupId>
13+
<artifactId>spring-boot-starter-parent</artifactId>
14+
<version>1.5.7.RELEASE</version>
15+
</parent>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.springframework.boot</groupId>
20+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-devtools</artifactId>
25+
<optional>true</optional>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-web</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-starter-tomcat</artifactId>
34+
<scope>provided</scope>
35+
</dependency>
36+
</dependencies>
37+
38+
39+
<build>
40+
<plugins>
41+
<plugin>
42+
<groupId>org.springframework.boot</groupId>
43+
<artifactId>spring-boot-maven-plugin</artifactId>
44+
</plugin>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-dependency-plugin</artifactId>
48+
<version>3.0.2</version>
49+
<executions>
50+
<execution>
51+
<phase>package</phase>
52+
<goals><goal>copy</goal></goals>
53+
<configuration>
54+
<artifactItems>
55+
<artifactItem>
56+
<groupId>com.github.jsimone</groupId>
57+
<artifactId>webapp-runner</artifactId>
58+
<version>8.5.23.0</version>
59+
<destFileName>webapp-runner.jar</destFileName>
60+
</artifactItem>
61+
</artifactItems>
62+
</configuration>
63+
</execution>
64+
</executions>
65+
</plugin>
66+
</plugins>
67+
</build>
68+
69+
</project>

src/main/java/hello/Application.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package hello;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.web.support.SpringBootServletInitializer;
6+
import org.springframework.boot.builder.SpringApplicationBuilder;
7+
8+
@SpringBootApplication
9+
public class Application extends SpringBootServletInitializer {
10+
11+
@Override
12+
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
13+
return application.sources(Application.class);
14+
}
15+
16+
public static void main(String[] args) {
17+
SpringApplication.run(Application.class, args);
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package hello;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.ui.Model;
5+
import org.springframework.web.bind.annotation.RequestMapping;
6+
import org.springframework.web.bind.annotation.RequestParam;
7+
8+
@Controller
9+
public class GreetingController {
10+
11+
@RequestMapping("/greeting")
12+
public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name,
13+
Model model) {
14+
model.addAttribute("name", name);
15+
return "greeting";
16+
}
17+
18+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE HTML>
2+
<html xmlns:th="http://www.thymeleaf.org">
3+
<head>
4+
<title>Getting Started: Serving Web Content</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6+
</head>
7+
<body>
8+
<p th:text="'Hello, ' + ${name} + '!'" />
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)