Expose load-on-startup for Jersey

This commit adds a `spring.jersey.filter.load-on-startup` property used to
customize the startup priority of the Jersey servlet.

Closes gh-5100
This commit is contained in:
Stephane Nicoll
2016-03-29 14:18:18 +02:00
parent 928f2dfc91
commit c752fac5c0
5 changed files with 116 additions and 10 deletions

View File

@@ -284,6 +284,7 @@ content into your application; rather pick only the properties that you need.
spring.jersey.application-path= # Path that serves as the base URI for the application. Overrides the value of "@ApplicationPath" if specified.
spring.jersey.filter.order=0 # Jersey filter chain order.
spring.jersey.init.*= # Init parameters to pass to Jersey via the servlet or filter.
spring.jersey.servlet.load-on-startup=-1 # Load on startup priority of the Jersey servlet.
spring.jersey.type=servlet # Jersey integration type. Can be either "servlet" or "filter".
# SPRING MOBILE DEVICE VIEWS ({sc-spring-boot-autoconfigure}/mobile/DeviceDelegatingViewResolverAutoConfiguration.{sc-ext}[DeviceDelegatingViewResolverAutoConfiguration])

View File

@@ -1859,12 +1859,14 @@ servlet will be registered and mapped to `/*` by default. You can change the map
by adding `@ApplicationPath` to your `ResourceConfig`.
By default Jersey will be set up as a Servlet in a `@Bean` of type
`ServletRegistrationBean` named `jerseyServletRegistration`. You can disable or override
that bean by creating one of your own with the same name. You can also use a Filter
instead of a Servlet by setting `spring.jersey.type=filter` (in which case the `@Bean` to
replace or override is `jerseyFilterRegistration`). The servlet has an `@Order` which you
can set with `spring.jersey.filter.order`. Both the Servlet and the Filter registrations
can be given init parameters using `spring.jersey.init.*` to specify a map of properties.
`ServletRegistrationBean` named `jerseyServletRegistration`. By default, the servlet will
be initialized lazily but you can customize it with
`spring.jersey.servlet.load-on-startup` .You can disable or override that bean by creating
one of your own with the same name. You can also use a Filter instead of a Servlet by
setting `spring.jersey.type=filter` (in which case the `@Bean` to replace or override is
`jerseyFilterRegistration`). The servlet has an `@Order` which you can set with
`spring.jersey.filter.order`. Both the Servlet and the Filter registrations can be given
init parameters using `spring.jersey.init.*` to specify a map of properties.
There is a {github-code}/spring-boot-samples/spring-boot-sample-jersey[Jersey sample] so
you can see how to set things up. There is also a