|
@@ -183,19 +183,28 @@ mvn package && java -jar target/{project_id}-0.1.0.jar
|
183
|
183
|
You will see a new set of RESTful end points added to the application. These are management services provided by Spring Boot.
|
184
|
184
|
|
185
|
185
|
....
|
186
|
|
-2013-08-01 08:03:42.592 INFO 43851 ... Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.boot.ops.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
|
187
|
|
-2013-08-01 08:03:42.592 INFO 43851 ... Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.ops.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
|
188
|
|
-2013-08-01 08:03:42.844 INFO 43851 ... Mapped URL path [/env] onto handler of type [class org.springframework.boot.ops.endpoint.EnvironmentEndpoint]
|
189
|
|
-2013-08-01 08:03:42.844 INFO 43851 ... Mapped URL path [/health] onto handler of type [class org.springframework.boot.ops.endpoint.HealthEndpoint]
|
190
|
|
-2013-08-01 08:03:42.844 INFO 43851 ... Mapped URL path [/beans] onto handler of type [class org.springframework.boot.ops.endpoint.BeansEndpoint]
|
191
|
|
-2013-08-01 08:03:42.844 INFO 43851 ... Mapped URL path [/info] onto handler of type [class org.springframework.boot.ops.endpoint.InfoEndpoint]
|
192
|
|
-2013-08-01 08:03:42.845 INFO 43851 ... Mapped URL path [/metrics] onto handler of type [class org.springframework.boot.ops.endpoint.MetricsEndpoint]
|
193
|
|
-2013-08-01 08:03:42.845 INFO 43851 ... Mapped URL path [/trace] onto handler of type [class org.springframework.boot.ops.endpoint.TraceEndpoint]
|
194
|
|
-2013-08-01 08:03:42.845 INFO 43851 ... Mapped URL path [/dump] onto handler of type [class org.springframework.boot.ops.endpoint.DumpEndpoint]
|
195
|
|
-2013-08-01 08:03:42.845 INFO 43851 ... Mapped URL path [/shutdown] onto handler of type [class org.springframework.boot.ops.endpoint.ShutdownEndpoint]
|
|
186
|
+2014-06-03 13:23:28.119 ... : Mapped "{[/error],methods=[],params=[],headers=[],consumes...
|
|
187
|
+2014-06-03 13:23:28.119 ... : Mapped "{[/error],methods=[],params=[],headers=[],consumes...
|
|
188
|
+2014-06-03 13:23:28.136 ... : Mapped URL path [/**] onto handler of type [class org.spri...
|
|
189
|
+2014-06-03 13:23:28.136 ... : Mapped URL path [/webjars/**] onto handler of type [class ...
|
|
190
|
+2014-06-03 13:23:28.440 ... : Mapped "{[/info],methods=[GET],params=[],headers=[],consum...
|
|
191
|
+2014-06-03 13:23:28.441 ... : Mapped "{[/autoconfig],methods=[GET],params=[],headers=[],...
|
|
192
|
+2014-06-03 13:23:28.441 ... : Mapped "{[/mappings],methods=[GET],params=[],headers=[],co...
|
|
193
|
+2014-06-03 13:23:28.442 ... : Mapped "{[/trace],methods=[GET],params=[],headers=[],consu...
|
|
194
|
+2014-06-03 13:23:28.442 ... : Mapped "{[/env/{name:.*}],methods=[GET],params=[],headers=...
|
|
195
|
+2014-06-03 13:23:28.442 ... : Mapped "{[/env],methods=[GET],params=[],headers=[],consume...
|
|
196
|
+2014-06-03 13:23:28.443 ... : Mapped "{[/configprops],methods=[GET],params=[],headers=[]...
|
|
197
|
+2014-06-03 13:23:28.443 ... : Mapped "{[/metrics/{name:.*}],methods=[GET],params=[],head...
|
|
198
|
+2014-06-03 13:23:28.443 ... : Mapped "{[/metrics],methods=[GET],params=[],headers=[],con...
|
|
199
|
+2014-06-03 13:23:28.444 ... : Mapped "{[/health],methods=[GET],params=[],headers=[],cons...
|
|
200
|
+2014-06-03 13:23:28.444 ... : Mapped "{[/dump],methods=[GET],params=[],headers=[],consum...
|
|
201
|
+2014-06-03 13:23:28.445 ... : Mapped "{[/beans],methods=[GET],params=[],headers=[],consu...
|
196
|
202
|
....
|
197
|
203
|
|
198
|
|
-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/dump[dump], and shutdown.
|
|
204
|
+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].
|
|
205
|
+
|
|
206
|
+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
|
|
207
|
+`endpoints.shutdown.enabled=true` to your `application.properties` file.
|
199
|
208
|
|
200
|
209
|
It's easy to check the health of the app.
|
201
|
210
|
|
|
@@ -204,18 +213,14 @@ $ curl localhost:8080/health
|
204
|
213
|
ok
|
205
|
214
|
----
|
206
|
215
|
|
207
|
|
-You can invoke shutdown through curl.
|
|
216
|
+You can try to invoke shutdown through curl.
|
208
|
217
|
|
209
|
218
|
----
|
210
|
219
|
$ curl -X POST localhost:8080/shutdown
|
|
220
|
+{"timestamp":1401820343710,"error":"Method Not Allowed","status":405,"message":"Request method 'POST' not supported"}
|
211
|
221
|
----
|
212
|
222
|
|
213
|
|
-The response shows that shutdown through REST is currently disabled by default:
|
214
|
|
-----
|
215
|
|
-{"message":"Shutdown not enabled, sorry."}
|
216
|
|
-----
|
217
|
|
-
|
218
|
|
-Whew! You probably don't want that until you are ready to turn on proper security settings, if at all.
|
|
223
|
+Because we didn't enable it, the request is blocked by the virtue of not existing.
|
219
|
224
|
|
220
|
225
|
For more details about each of these REST points and how you can tune their settings with an `application.properties` file, you can read detailed http://docs.spring.io/spring-boot/docs/{spring_boot_version}/reference/htmlsingle/#production-ready-endpoints[docs about the endpoints].
|
221
|
226
|
|