Просмотр исходного кода

Extract common copy into macros

Introduce mocked-up macro syntax with the goal of eliminating
duplication of common sections, introductions, disclaimers, etc.

See gs-macros.md[1] for expanded values.

[1]: https://github.com/springframework-meta/springframework.org/tree/master/doc/gs-macros.md
Chris Beams 13 лет назад
Родитель
Сommit
bf9a887476
1 измененных файлов: 11 добавлений и 42 удалений
  1. 11
    42
      README.md

+ 11
- 42
README.md Просмотреть файл

1
-# Getting Started: Building a RESTful Web Service
2
-
3
-[![Build Status](https://drone.io/github.com/springframework-meta/gs-rest-service/status.png)](https://drone.io/github.com/springframework-meta/gs-rest-service/latest)
1
+<!-- See expanded [macro:...] values at https://github.com/springframework-meta/springframework.org/tree/master/doc/gs-macros.md -->
4
 
2
 
3
+# Getting Started: Building a RESTful Web Service
5
 
4
 
6
 What you'll build
5
 What you'll build
7
 -----------------
6
 -----------------
25
  - Your choice of Maven (3.0+) or Gradle (1.5+)
24
  - Your choice of Maven (3.0+) or Gradle (1.5+)
26
 
25
 
27
 
26
 
28
-How to complete this guide
29
---------------------------
30
-
31
-Like all Spring's [Getting Started guides](/getting-started), you can choose to start from scratch and complete each step, or you can jump past basic setup steps that may already be familiar to you. Either way, you'll end up with working code.
32
-
33
-To **start from scratch**, just move on to the next section and start [setting up the project](#scratch).
34
-
35
-If you'd like to **skip the basics**, then do the following:
36
-
37
- - [download][zip] and unzip the source repository for this guide—or clone it using [git](/understanding/git):
38
-`git clone https://github.com/springframework-meta/gs-rest-service.git`
39
- - cd into `gs-rest-service/initial`
40
- - jump ahead to [create a representation class](#initial).
41
-
42
-And **when you're finished**, you can check your results against the the code in `gs-rest-service/complete`.
27
+[macro:how-to-complete-this-guide]
43
 
28
 
44
 
29
 
45
 <a name="scratch"></a>
30
 <a name="scratch"></a>
46
 Set up the project
31
 Set up the project
47
 ------------------
32
 ------------------
48
-First you'll need to set up a basic build script. You can use any build system you like when building apps with Spring, but we've included what you'll need to work with [Maven](https://maven.apache.org) and [Gradle](http://gradle.org) here. If you're not familiar with either of these, you can refer to our [Getting Started with Maven](../gs-maven/README.md) or [Getting Started with Gradle](../gs-gradle/README.md) guides.
33
+[macro:build-system-intro]
49
 
34
 
50
 <span class="maven">
35
 <span class="maven">
51
-Create a Maven POM that looks like this:
36
+### Create a Maven POM
52
 
37
 
53
 `pom.xml`
38
 `pom.xml`
54
 ```xml
39
 ```xml
96
 </project>
81
 </project>
97
 ```
82
 ```
98
 
83
 
99
-TODO: mention that we're using Spring Bootstrap's [_starter POMs_](../gs-bootstrap-starter) here.
100
-
101
-Experienced Maven users who feel nervous about using an external parent project: don't panic, you can take it out later, it's just there to reduce the amount of code you have to write to get started.
84
+[macro:bootstrap-starter-pom-disclaimer]
102
 </span>
85
 </span>
103
 
86
 
104
 <span class="gradle">
87
 <span class="gradle">
88
+### Create a Gradle build script
105
 `build.gradle`
89
 `build.gradle`
106
 ```groovy
90
 ```groovy
107
 TODO: paste complete build.gradle.
91
 TODO: paste complete build.gradle.
135
 
119
 
136
 
120
 
137
 <a name="initial"></a>
121
 <a name="initial"></a>
138
-Create a representation class
139
------------------------------
122
+Create a resource representation class
123
+--------------------------------------
140
 With the essential Spring MVC configuration out of the way, it's time to get to the nuts and bolts of our REST service by creating a resource representation class and an endpoint controller.
124
 With the essential Spring MVC configuration out of the way, it's time to get to the nuts and bolts of our REST service by creating a resource representation class and an endpoint controller.
141
 
125
 
142
 Before we get too carried away with building the endpoint controller, we need to give some thought to what our API will look like.
126
 Before we get too carried away with building the endpoint controller, we need to give some thought to what our API will look like.
152
 
136
 
153
 The `id` field is a unique identifier for the greeting, and `content` is the textual representation of the greeting.
137
 The `id` field is a unique identifier for the greeting, and `content` is the textual representation of the greeting.
154
 
138
 
155
-To model the greeting representation, we’ll create a representation class:
139
+To model the greeting representation, create a representation class:
156
 
140
 
157
 `src/main/java/hello/Greeting.java`
141
 `src/main/java/hello/Greeting.java`
158
 ```java
142
 ```java
297
 
281
 
298
 Congratulations! You have just developed a simple RESTful service using Spring. This is a basic foundation for building a complete REST API in Spring.
282
 Congratulations! You have just developed a simple RESTful service using Spring. This is a basic foundation for building a complete REST API in Spring.
299
 
283
 
300
-
301
-<span class="related">
302
-Related resources
303
------------------
304
-
305
-There's more to building RESTful web services than is covered here. You may want to continue your exploration of Spring and REST with the following Getting Started guides:
306
-
307
-* Handling POST, PUT, and GET requests in REST services
308
-* Creating self-describing APIs with HATEOAS
309
-* Securing a REST service with HTTP Basic
310
-* Securing a REST service with OAuth
311
-* [Consuming REST services](https://github.com/springframework-meta/gs-consuming-rest-core/blob/master/README.md)
312
-* Testing REST services
313
-</span>
314
-
315
 [zip]: https://github.com/springframework-meta/gs-rest-service/archive/master.zip
284
 [zip]: https://github.com/springframework-meta/gs-rest-service/archive/master.zip
316
-[jdk7]: http://docs.oracle.com/javase/7/docs/webnotes/install/index.html
285
+[jdk7]: http://docs.oracle.com/javase/7/docs/webnotes/install/index.html