瀏覽代碼

Factor out additional macros

Chris Beams 13 年之前
父節點
當前提交
0b189eeb08
共有 1 個檔案被更改,包括 4 行新增44 行删除
  1. 4
    44
      README.md

+ 4
- 44
README.md 查看文件

26
 ----------------
26
 ----------------
27
 
27
 
28
  - About 15 minutes
28
  - About 15 minutes
29
- - A favorite text editor or IDE
30
- - [JDK 6][jdk] or later
31
- - [Maven 3.0][mvn] or later
29
+ - [macro:prereq-editor-jdk-buildtools]
32
 
30
 
33
-[macro:how-to-complete-this-guide]
31
+## [macro:how-to-complete-this-guide]
34
 
32
 
35
 
33
 
36
 <a name="scratch"></a>
34
 <a name="scratch"></a>
39
 
37
 
40
 [macro:build-system-intro]
38
 [macro:build-system-intro]
41
 
39
 
42
-### Create the directory structure
43
-
44
-In a project directory of your choosing, create the following subdirectory structure; for example, with `mkdir -p src/main/java/hello` on *nix systems:
45
-
46
-    └── src
47
-        └── main
48
-            └── java
49
-                └── hello
40
+[macro:create-directory-structure-hello]
50
 
41
 
51
 ### Create a Maven POM
42
 ### Create a Maven POM
52
 
43
 
227
 
218
 
228
 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.
219
 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.
229
 
220
 
230
-### Build an executable JAR
231
-
232
-Now that your `Application` class is ready, you simply instruct the build system to create a single, executable jar containing everything. This makes it easy to ship, version, and deploy the service as an application throughout the development lifecycle, across different environments, and so forth.
233
-
234
-Add the following configuration to your existing Maven POM:
235
-
236
-`pom.xml`
237
-```xml
238
-    <properties>
239
-        <start-class>hello.Application</start-class>
240
-    </properties>
241
-
242
-    <build>
243
-        <plugins>
244
-            <plugin>
245
-                <groupId>org.apache.maven.plugins</groupId>
246
-                <artifactId>maven-shade-plugin</artifactId>
247
-            </plugin>
248
-        </plugins>
249
-    </build>
250
-```
251
-
252
-The `start-class` property tells Maven to create a `META-INF/MANIFEST.MF` file with a `Main-Class: hello.Application` entry. This entry enables you to run the jar with `java -jar`.
253
-
254
-The [Maven Shade plugin][maven-shade-plugin] extracts classes from all the jars on the classpath and builds a single "über-jar", which makes it more convenient to execute and transport your service.
255
-
256
-Now run the following to produce a single executable JAR file containing all necessary dependency classes and resources:
257
-
258
-    mvn package
221
+### [macro:build-an-executable-jar]
259
 
222
 
260
 
223
 
261
 Run the service
224
 Run the service
290
 Congrats! You've just developed a RESTful web service with Spring. This of course is just the beginning, and there are many more features to explore and take advantage of. Be sure to check out Spring's support for [securing](TODO), [describing](TODO) [managing](TODO), [testing](TODO) and [consuming](/gs-consuming-rest) RESTful web services.
253
 Congrats! You've just developed a RESTful web service with Spring. This of course is just the beginning, and there are many more features to explore and take advantage of. Be sure to check out Spring's support for [securing](TODO), [describing](TODO) [managing](TODO), [testing](TODO) and [consuming](/gs-consuming-rest) RESTful web services.
291
 
254
 
292
 
255
 
293
-[mvn]: http://maven.apache.org/download.cgi
294
 [zip]: https://github.com/springframework-meta/gs-rest-service/archive/master.zip
256
 [zip]: https://github.com/springframework-meta/gs-rest-service/archive/master.zip
295
-[jdk]: http://www.oracle.com/technetwork/java/javase/downloads/index.html
296
 [u-rest]: /understanding/rest
257
 [u-rest]: /understanding/rest
297
 [u-json]: /understanding/json
258
 [u-json]: /understanding/json
298
 [u-jsp]: /understanding/jsp
259
 [u-jsp]: /understanding/jsp
300
 [u-war]: /understanding/war
261
 [u-war]: /understanding/war
301
 [u-tomcat]: /understanding/tomcat
262
 [u-tomcat]: /understanding/tomcat
302
 [u-application-context]: /understanding/application-context
263
 [u-application-context]: /understanding/application-context
303
-[maven-shade-plugin]: https://maven.apache.org/plugins/maven-shade-plugin
304
 [`@Controller`]: http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/stereotype/Controller.html
264
 [`@Controller`]: http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/stereotype/Controller.html
305
 [`SpringApplication`]: http://static.springsource.org/spring-bootstrap/docs/0.5.0.BUILD-SNAPSHOT/javadoc-api/org/springframework/bootstrap/SpringApplication.html
265
 [`SpringApplication`]: http://static.springsource.org/spring-bootstrap/docs/0.5.0.BUILD-SNAPSHOT/javadoc-api/org/springframework/bootstrap/SpringApplication.html
306
 [`@EnableAutoConfiguration`]: http://static.springsource.org/spring-bootstrap/docs/0.5.0.BUILD-SNAPSHOT/javadoc-api/org/springframework/bootstrap/context/annotation/SpringApplication.html
266
 [`@EnableAutoConfiguration`]: http://static.springsource.org/spring-bootstrap/docs/0.5.0.BUILD-SNAPSHOT/javadoc-api/org/springframework/bootstrap/context/annotation/SpringApplication.html