|
|
|
|
9
|
:source-highlighter: prettify
|
9
|
:source-highlighter: prettify
|
10
|
:project_id: gs-spring-boot
|
10
|
:project_id: gs-spring-boot
|
11
|
This guide provides a sampling of how {spring-boot}[Spring Boot] helps you accelerate and facilitate application development. As you read more Spring Getting Started guides, you will see more use cases for Spring Boot.
|
11
|
This guide provides a sampling of how {spring-boot}[Spring Boot] helps you accelerate and facilitate application development. As you read more Spring Getting Started guides, you will see more use cases for Spring Boot.
|
12
|
-It is meant to give you a quick taste of Spring Boot. If you want to create your own Spring Boot-based project, visit
|
|
|
|
|
12
|
+It is meant to give you a quick taste of Spring Boot. If you want to create your own Spring Boot-based project, visit
|
13
|
http://start.spring.io/[Spring Initializr], fill in your project details, pick your options, and you can download either
|
13
|
http://start.spring.io/[Spring Initializr], fill in your project details, pick your options, and you can download either
|
14
|
a Maven build file, or a bundled up project as a zip file.
|
14
|
a Maven build file, or a bundled up project as a zip file.
|
15
|
|
15
|
|
|
|
|
|
52
|
----
|
52
|
----
|
53
|
include::initial/src/main/java/hello/HelloController.java[]
|
53
|
include::initial/src/main/java/hello/HelloController.java[]
|
54
|
----
|
54
|
----
|
55
|
-
|
|
|
|
|
55
|
+
|
56
|
The class is flagged as a `@RestController`, meaning it's ready for use by Spring MVC to handle web requests. `@RequestMapping` maps `/` to the `index()` method. When invoked from a browser or using curl on the command line, the method returns pure text. That's because `@RestController` combines `@Controller` and `@ResponseBody`, two annotations that results in web requests returning data rather than a view.
|
56
|
The class is flagged as a `@RestController`, meaning it's ready for use by Spring MVC to handle web requests. `@RequestMapping` maps `/` to the `index()` method. When invoked from a browser or using curl on the command line, the method returns pure text. That's because `@RestController` combines `@Controller` and `@ResponseBody`, two annotations that results in web requests returning data rather than a view.
|
57
|
|
57
|
|
58
|
== Create an Application class
|
58
|
== Create an Application class
|
|
|
|
|
224
|
|
224
|
|
225
|
They include: errors, http://localhost:8080/env[environment], http://localhost:8080/health[health], http://localhost:8080/beans[beans], http://localhost:8080/info[info], http://localhost:8080/metrics[metrics], http://localhost:8080/trace[trace], http://localhost:8080/configprops[configprops], and http://localhost:8080/dump[dump].
|
225
|
They include: errors, http://localhost:8080/env[environment], http://localhost:8080/health[health], http://localhost:8080/beans[beans], http://localhost:8080/info[info], http://localhost:8080/metrics[metrics], http://localhost:8080/trace[trace], http://localhost:8080/configprops[configprops], and http://localhost:8080/dump[dump].
|
226
|
|
226
|
|
227
|
-NOTE: There is also a `/shutdown` endpoint, but it's only visible by default via JMX. To http://docs.spring.io/spring-boot/docs/{spring_boot_version}/reference/htmlsingle/#production-ready-customizing-endpoints[enable it as an HTTP endpoint], add
|
|
|
|
|
227
|
+NOTE: There is also a `/shutdown` endpoint, but it's only visible by default via JMX. To http://docs.spring.io/spring-boot/docs/{spring_boot_version}/reference/htmlsingle/#production-ready-customizing-endpoints[enable it as an HTTP endpoint], add
|
228
|
`endpoints.shutdown.enabled=true` to your `application.properties` file.
|
228
|
`endpoints.shutdown.enabled=true` to your `application.properties` file.
|
229
|
|
229
|
|
230
|
It's easy to check the health of the app.
|
230
|
It's easy to check the health of the app.
|
|
|
|
|
295
|
This is only a small sampling of what Spring Boot can do. Checkout http://docs.spring.io/spring-boot/docs/{spring_boot_version}/reference/htmlsingle[Spring Boot's online docs]
|
295
|
This is only a small sampling of what Spring Boot can do. Checkout http://docs.spring.io/spring-boot/docs/{spring_boot_version}/reference/htmlsingle[Spring Boot's online docs]
|
296
|
if you want to dig deeper.
|
296
|
if you want to dig deeper.
|
297
|
|
297
|
|
298
|
-include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/footer.adoc[]
|
|
|
|
|
298
|
+== See Also
|
|
|
299
|
+
|
|
|
300
|
+The following guides may also be helpful:
|
299
|
|
301
|
|
|
|
302
|
+* https://spring.io/guides/gs/securing-web/[Securing a Web Application]
|
|
|
303
|
+* https://spring.io/guides/gs/serving-web-content/[Serving Web Content with Spring MVC]
|
|
|
304
|
+
|
|
|
305
|
+include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/footer.adoc[]
|