Polish Actuator MVC customization support

See gh-3345
This commit is contained in:
Phillip Webb
2015-06-30 18:46:37 -07:00
parent c84658af1b
commit b5c435f8c4
18 changed files with 345 additions and 272 deletions

View File

@@ -150,23 +150,23 @@ For example, the following will disable _all_ endpoints except for `info`:
endpoints.info.enabled=true
----
[[production-ready-customizing-endpoints-programmatically]]
=== Adding Custom Endpoints
If you add a `@Bean` of type `Endpoint` then it will automatically be exposed over JMX and
HTTP (if there is an server available). An HTTP endpoints can be customized further by
creating a bean of type `MvcEndpoint`. Your `MvcEndpoint` is not a `@Controller` but it
can use `@RequestMapping` (and `@Managed*`) to expose resources.
If you add a `@Bean` of type `Endpoint` then it will automatically be
exposed over JMX and HTTP (if there is an server available). An HTTP
endpoints can be customized further by creating a bean of type
`MvcEndpoint`. Your `MvcEndpoint` is not a `@Controller` but it can use
`@RequestMapping` (and `@Managed*`) to expose resources.
TIP: If you are doing this as a library feature consider adding a configuration class to
`/META-INF/spring.factories` under the key
`org.springframework.boot.actuate.autoconfigure.EndpointWebMvcConfiguration`. If you do
that then the endpoint will move to a child context with all the other MVC endpoints if
your users ask for a separate management port or address. A configuration declared this
way can be a `WebConfigurerAdapter` if it wants to add static resources (for instance) to
the management endpoints.
TIP: If you are doing this as a library feature consider adding a
configuration class to `/META-INF/spring.factories` under the key
`org.springframework.boot.actuate.autoconfigure.EndpointWebMvcConfiguration`.
If you do that then the endpoint will move to a child context with all
the other MVC endpoints if your users ask for a separate management port
or address. A configuration declared this way can be a `WebConfigurerAdapter`
if it wants to add static resources (for instance) to the management
endpoints.
[[production-ready-health]]

View File

@@ -1175,12 +1175,11 @@ Spring decides not to handle it. Most of the time this will not happen (unless y
the default MVC configuration) because Spring will always be able to handle requests
through the `DispatcherServlet`.
You can customize the static resource locations using
`spring.resources.staticLocations` (replacing the default values with
a list of directory locations). If you do this the default welcome
page detection will switch to your custom locations, so if there is an
`index.html` in any of your locations on startup, it will be the home
page of the application.
You can customize the static resource locations using `spring.resources.staticLocations`
(replacing the default values with a list of directory locations). If you do this the
default welcome page detection will switch to your custom locations, so if there is an
`index.html` in any of your locations on startup, it will be the home page of the
application.
In addition to the '`standard`' static resource locations above, a special case is made
for http://www.webjars.org/[Webjars content]. Any resources with a path in `+/webjars/**+`