Explorar el Código

Polish up Spring Boot guide

Greg Turnquist hace 13 años
padre
commit
f32b3175fb
Se han modificado 2 ficheros con 32 adiciones y 14 borrados
  1. 16
    7
      README.ftl.md
  2. 16
    7
      README.md

+ 16
- 7
README.ftl.md Ver fichero

131
 
131
 
132
 Adding multipart upload support
132
 Adding multipart upload support
133
 -------------------------------
133
 -------------------------------
134
-You should also update your configuration and add a `MultipartConfigElement` to the application context.
134
+Imagine you also want to add file upload support. To do that, update your configuration and add a `MultipartConfigElement` to the application context.
135
 
135
 
136
     <@snippet path="src/main/java/hello/Application.java" prefix="complete"/>
136
     <@snippet path="src/main/java/hello/Application.java" prefix="complete"/>
137
     
137
     
193
 
193
 
194
 There is also the `multipartConfigElement` you added. But along with it came a `multipartResolver` [courtesy of Spring Boot](https://github.com/SpringSource/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java), a bean recommended to support file uploads with Spring MVC.
194
 There is also the `multipartConfigElement` you added. But along with it came a `multipartResolver` [courtesy of Spring Boot](https://github.com/SpringSource/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java), a bean recommended to support file uploads with Spring MVC.
195
 
195
 
196
-Other than that, everything else appears the same, as it should be. Most the beans listed above provide Spring MVC's production-grade features. Just swapping one aspect, the container, and adding upload support shouldn't cause a system wide ripple.
196
+Other than that, everything else appears the same, as it should be. Most the beans listed above provide Spring MVC's production-grade features. Just swapping one part, the servlet container, and adding upload support shouldn't cause a system wide ripple.
197
 
197
 
198
 Adding consumer-grade services
198
 Adding consumer-grade services
199
 ------------------------------
199
 ------------------------------
200
-If you are building a web site for your business, there are probably some management services you are thinking about adding. Spring Boot provides several out of the box with it's [actuator module][spring-boot-actuator] like health, audits, beans, and more.
200
+If you are building a web site for your business, there are probably some management services you are thinking about adding. Spring Boot provides several out of the box with its [actuator module][spring-boot-actuator] like health, audits, beans, and more.
201
 
201
 
202
 Add this to your pom.xml:
202
 Add this to your pom.xml:
203
 ```xml
203
 ```xml
245
 $ curl -X POST localhost:8080/shutdown
245
 $ curl -X POST localhost:8080/shutdown
246
 ```
246
 ```
247
 
247
 
248
-The response shows that shutdown through REST is currently disabled:
248
+The response shows that shutdown through REST is currently disabled by default (thank goodness!):
249
 ```sh
249
 ```sh
250
 {"message":"Shutdown not enabled, sorry."}
250
 {"message":"Shutdown not enabled, sorry."}
251
 ```
251
 ```
252
 
252
 
253
-For more details about each of these REST points, you'll have to dig into the [Spring Boot][spring-boot] project itself.
253
+For more details about each of these REST points and how you can tune their settings with an ``application.properties` file, feel free to dig into the [Spring Boot][spring-boot] project.
254
 
254
 
255
 That is not all
255
 That is not all
256
 ---------------
256
 ---------------
257
 That last example showed how Spring Boot makes it easy to wire beans you may not be aware you need. And it showed how to turn on convenient management services.
257
 That last example showed how Spring Boot makes it easy to wire beans you may not be aware you need. And it showed how to turn on convenient management services.
258
 
258
 
259
-But Spring Boot does more than that. It supports not only traditional WAR file deployments, but also makes it easy to put together executable JARs thanks to Spring Boot's loader module. The various guides demonstrate this dual support through the `spring-boot-maven-plugin`. On top of that, Spring Boot also have Groovy support, allowing you to build web apps with as little as a single file:
259
+But Spring Boot does yet more. It supports not only traditional WAR file deployments, but also makes it easy to put together executable JARs thanks to Spring Boot's loader module. The various guides demonstrate this dual support through the `spring-boot-maven-plugin`. 
260
+
261
+On top of that, Spring Boot also has Groovy support, allowing you to build web apps with as little as a single file.
262
+
263
+Put the following code inside **app.groovy**:
260
 
264
 
261
 ```groovy
265
 ```groovy
262
 @Controller
266
 @Controller
270
 
274
 
271
 }
275
 }
272
 ```
276
 ```
273
-Spring Boot dynamically adds key annotations toy our code and leverages [Groovy Grapes](http://groovy.codehaus.org/Grape) to pull down needed libraries to make the app run. With Spring Boot's CLI tool, all you need do is:
277
+
278
+Next, [install Spring Boot's CLI](https://github.com/SpringSource/spring-boot#installing-the-cli).
279
+
280
+Finally, run it as follows:
274
 
281
 
275
 ```sh
282
 ```sh
276
 $ spring run app.groovy
283
 $ spring run app.groovy
278
 Hello World!
285
 Hello World!
279
 ```
286
 ```
280
 
287
 
288
+Spring Boot dynamically adds key annotations to your code and leverages [Groovy Grapes](http://groovy.codehaus.org/Grape) to pull down needed libraries to make the app run.
289
+
281
 Congratulations!
290
 Congratulations!
282
 ----------------
291
 ----------------
283
 Spring Boot is powerful, but frankly too big to fit into a single guide. This is just a sampling of how much it can ramp up your development pace, letting you focus on business features and not worry about infrastructure.
292
 Spring Boot is powerful, but frankly too big to fit into a single guide. This is just a sampling of how much it can ramp up your development pace, letting you focus on business features and not worry about infrastructure.

+ 16
- 7
README.md Ver fichero

259
 
259
 
260
 Adding multipart upload support
260
 Adding multipart upload support
261
 -------------------------------
261
 -------------------------------
262
-You should also update your configuration and add a `MultipartConfigElement` to the application context.
262
+Imagine you also want to add file upload support. To do that, update your configuration and add a `MultipartConfigElement` to the application context.
263
 
263
 
264
 `src/main/java/hello/Application.java`
264
 `src/main/java/hello/Application.java`
265
 ```java
265
 ```java
361
 
361
 
362
 There is also the `multipartConfigElement` you added. But along with it came a `multipartResolver` [courtesy of Spring Boot](https://github.com/SpringSource/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java), a bean recommended to support file uploads with Spring MVC.
362
 There is also the `multipartConfigElement` you added. But along with it came a `multipartResolver` [courtesy of Spring Boot](https://github.com/SpringSource/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java), a bean recommended to support file uploads with Spring MVC.
363
 
363
 
364
-Other than that, everything else appears the same, as it should be. Most the beans listed above provide Spring MVC's production-grade features. Just swapping one aspect, the container, and adding upload support shouldn't cause a system wide ripple.
364
+Other than that, everything else appears the same, as it should be. Most the beans listed above provide Spring MVC's production-grade features. Just swapping one part, the servlet container, and adding upload support shouldn't cause a system wide ripple.
365
 
365
 
366
 Adding consumer-grade services
366
 Adding consumer-grade services
367
 ------------------------------
367
 ------------------------------
368
-If you are building a web site for your business, there are probably some management services you are thinking about adding. Spring Boot provides several out of the box with it's [actuator module][spring-boot-actuator] like health, audits, beans, and more.
368
+If you are building a web site for your business, there are probably some management services you are thinking about adding. Spring Boot provides several out of the box with its [actuator module][spring-boot-actuator] like health, audits, beans, and more.
369
 
369
 
370
 Add this to your pom.xml:
370
 Add this to your pom.xml:
371
 ```xml
371
 ```xml
413
 $ curl -X POST localhost:8080/shutdown
413
 $ curl -X POST localhost:8080/shutdown
414
 ```
414
 ```
415
 
415
 
416
-The response shows that shutdown through REST is currently disabled:
416
+The response shows that shutdown through REST is currently disabled by default (thank goodness!):
417
 ```sh
417
 ```sh
418
 {"message":"Shutdown not enabled, sorry."}
418
 {"message":"Shutdown not enabled, sorry."}
419
 ```
419
 ```
420
 
420
 
421
-For more details about each of these REST points, you'll have to dig into the [Spring Boot][spring-boot] project itself.
421
+For more details about each of these REST points and how you can tune their settings with an ``application.properties` file, feel free to dig into the [Spring Boot][spring-boot] project.
422
 
422
 
423
 That is not all
423
 That is not all
424
 ---------------
424
 ---------------
425
 That last example showed how Spring Boot makes it easy to wire beans you may not be aware you need. And it showed how to turn on convenient management services.
425
 That last example showed how Spring Boot makes it easy to wire beans you may not be aware you need. And it showed how to turn on convenient management services.
426
 
426
 
427
-But Spring Boot does more than that. It supports not only traditional WAR file deployments, but also makes it easy to put together executable JARs thanks to Spring Boot's loader module. The various guides demonstrate this dual support through the `spring-boot-maven-plugin`. On top of that, Spring Boot also have Groovy support, allowing you to build web apps with as little as a single file:
427
+But Spring Boot does yet more. It supports not only traditional WAR file deployments, but also makes it easy to put together executable JARs thanks to Spring Boot's loader module. The various guides demonstrate this dual support through the `spring-boot-maven-plugin`. 
428
+
429
+On top of that, Spring Boot also has Groovy support, allowing you to build web apps with as little as a single file.
430
+
431
+Put the following code inside **app.groovy**:
428
 
432
 
429
 ```groovy
433
 ```groovy
430
 @Controller
434
 @Controller
438
 
442
 
439
 }
443
 }
440
 ```
444
 ```
441
-Spring Boot dynamically adds key annotations toy our code and leverages [Groovy Grapes](http://groovy.codehaus.org/Grape) to pull down needed libraries to make the app run. With Spring Boot's CLI tool, all you need do is:
445
+
446
+Next, [install Spring Boot's CLI](https://github.com/SpringSource/spring-boot#installing-the-cli).
447
+
448
+Finally, run it as follows:
442
 
449
 
443
 ```sh
450
 ```sh
444
 $ spring run app.groovy
451
 $ spring run app.groovy
446
 Hello World!
453
 Hello World!
447
 ```
454
 ```
448
 
455
 
456
+Spring Boot dynamically adds key annotations to your code and leverages [Groovy Grapes](http://groovy.codehaus.org/Grape) to pull down needed libraries to make the app run.
457
+
449
 Congratulations!
458
 Congratulations!
450
 ----------------
459
 ----------------
451
 Spring Boot is powerful, but frankly too big to fit into a single guide. This is just a sampling of how much it can ramp up your development pace, letting you focus on business features and not worry about infrastructure.
460
 Spring Boot is powerful, but frankly too big to fit into a single guide. This is just a sampling of how much it can ramp up your development pace, letting you focus on business features and not worry about infrastructure.