|
|
@@ -102,7 +102,7 @@ Make the application executable
|
|
102
|
102
|
|
|
103
|
103
|
Although it is possible to package this service as a traditional [WAR][u-war] file for deployment to an external application server, the simpler approach demonstrated below creates a standalone application. You package everything in a single, executable JAR file, driven by a good old Java `main()` method. Along the way, you use Spring's support for embedding the [Tomcat][u-tomcat] servlet container as the HTTP runtime, instead of deploying to an external instance.
|
|
104
|
104
|
|
|
105
|
|
-### Create a main class
|
|
|
105
|
+### Create an Application class
|
|
106
|
106
|
|
|
107
|
107
|
<@snippet path="src/main/java/hello/Application.java" prefix="complete"/>
|
|
108
|
108
|
|
|
|
@@ -112,7 +112,9 @@ The `@ComponentScan` annotation tells Spring to search recursively through the `
|
|
112
|
112
|
|
|
113
|
113
|
The [`@EnableAutoConfiguration`][] annotation switches on reasonable default behaviors based on the content of your classpath. For example, because the application depends on the embeddable version of Tomcat (tomcat-embed-core.jar), a Tomcat server is set up and configured with reasonable defaults on your behalf. And because the application also depends on Spring MVC (spring-webmvc.jar), a Spring MVC [`DispatcherServlet`][] is configured and registered for you — no `web.xml` necessary! Auto-configuration is a powerful, flexible mechanism. See the [API documentation][`@EnableAutoConfiguration`] for further details.
|
|
114
|
114
|
|
|
115
|
|
-### <@build_an_executable_jar/>
|
|
|
115
|
+<@build_an_executable_jar_subhead/>
|
|
|
116
|
+
|
|
|
117
|
+<@build_an_executable_jar/>
|
|
116
|
118
|
|
|
117
|
119
|
<@run_the_application module="service"/>
|
|
118
|
120
|
|
|
|
@@ -140,7 +142,6 @@ Summary
|
|
140
|
142
|
|
|
141
|
143
|
Congratulations! You've just developed a RESTful web service with Spring.
|
|
142
|
144
|
|
|
143
|
|
-To see what else you can do with Spring and RESTful web services, see [Related Resources](TODO).
|
|
144
|
145
|
|
|
145
|
146
|
|
|
146
|
147
|
[u-rest]: /understanding/rest
|