File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .idea /*
2+ ** /target /*
3+ * .iml
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <modelVersion >4.0.0</modelVersion >
6+
7+ <groupId >sparkjava-hello-world</groupId >
8+ <artifactId >sparkjava-hello-world</artifactId >
9+ <version >1.0</version >
10+ <packaging >war</packaging >
11+
12+ <dependencies >
13+ <dependency >
14+ <groupId >com.sparkjava</groupId >
15+ <artifactId >spark-core</artifactId >
16+ <version >2.3</version >
17+ </dependency >
18+ </dependencies >
19+
20+ <build >
21+ <plugins >
22+ <plugin >
23+ <groupId >org.apache.maven.plugins</groupId >
24+ <artifactId >maven-compiler-plugin</artifactId >
25+ <version >3.1</version >
26+ <configuration >
27+ <source >1.8</source >
28+ <target >1.8</target >
29+ <optimize >true</optimize >
30+ <debug >true</debug >
31+ </configuration >
32+ </plugin >
33+ <plugin >
34+ <groupId >org.apache.maven.plugins</groupId >
35+ <artifactId >maven-enforcer-plugin</artifactId >
36+ <version >1.3.1</version >
37+ <executions >
38+ <execution >
39+ <id >enforce-java</id >
40+ <goals >
41+ <goal >enforce</goal >
42+ </goals >
43+ <configuration >
44+ <rules >
45+ <requireJavaVersion >
46+ <version >[1.8,)</version >
47+ </requireJavaVersion >
48+ </rules >
49+ </configuration >
50+ </execution >
51+ </executions >
52+ </plugin >
53+ </plugins >
54+ </build >
55+ </project >
Original file line number Diff line number Diff line change 1+ import spark .servlet .SparkApplication ;
2+
3+ import static spark .Spark .get ;
4+
5+ public class HelloWorld implements SparkApplication {
6+ public static void main (String [] args ) {
7+ new HelloWorld ().init ();
8+ }
9+
10+ @ Override
11+ public void init () {
12+ get ("/hello" , (req , res ) -> "Hello World" );
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ <web-app xmlns =" http://java.sun.com/xml/ns/javaee"
2+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
4+ version =" 3.0" >
5+
6+ <filter >
7+ <filter-name >SparkFilter</filter-name >
8+ <filter-class >spark.servlet.SparkFilter</filter-class >
9+ <init-param >
10+ <param-name >applicationClass</param-name >
11+ <param-value >HelloWorld</param-value >
12+ </init-param >
13+ </filter >
14+
15+ <filter-mapping >
16+ <filter-name >SparkFilter</filter-name >
17+ <url-pattern >/*</url-pattern >
18+ </filter-mapping >
19+ </web-app >
You can’t perform that action at this time.
0 commit comments