spring-boot/spring-boot-tests/spring-boot-smoke-tests
Andy Wilkinson 8f72ca6521 Use ResourceConfig customization to register endpoints with Jersey
Previously, actuator endpoints were registered with Jersey upon
injection of the ResourceConfig bean into a registrar class rather than
using a ResourceConfigCustomizer. This was done to fix a problem
when running the Actuator on a separate port where the main application
context's customizers were also applied to the management context,
breaking the singleton contract for those resources. This approach
meant that the registration could be performed at any point after the
ResourceConfig had been created. When Jersey's configured as a Filter
this resulted in the registration failing as the attempt was being made
after the Filter lifecyle callbacks which make the ResourceConfig
immutable.

This commit reworks the endpoint registration to be performed using a
ManagementContextResourceConfigCustomizer, a resource config customizer
that's only applied to the ResourceConfig that's used by the Actuator.
When there's a separate management context, this ResourceConfig is
created by the Actuator's auto-configuration and the management context
resource config customizers are applied to it during its creation. The
main application's customizers are not applied. When the actuator is
using the same context as the main application, this ResourceConfig is
created by the main application. In this case a
ResourceConfigCustomizer is defined that delegates to all
ManagementContextResourceConfigCustomizers, allowing them to register
the actuator endpoints with the main ResourceConfig.

Fixes gh-25262
2021-02-26 14:25:24 +00:00
..
spring-boot-smoke-test-activemq Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-actuator Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-actuator-custom-security Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-actuator-log4j2 Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-actuator-noweb Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-actuator-ui Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-amqp Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-animated-banner Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-ant Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-aop Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-atmosphere Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-batch Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-cache Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-couchbase Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-elasticsearch Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-jdbc Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-jpa Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-ldap Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-mongodb Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-neo4j Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-r2dbc Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-r2dbc-flyway Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-r2dbc-liquibase Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-redis Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-rest Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-data-solr Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-devtools Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-flyway Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-hateoas Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-hazelcast4 Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-hibernate52 Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-integration Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-jersey Use ResourceConfig customization to register endpoints with Jersey 2021-02-26 14:25:24 +00:00
spring-boot-smoke-test-jetty Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-jetty-jsp Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-jetty-ssl Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-jpa Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-jta-atomikos Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-jta-bitronix Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-junit-jupiter Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-junit-vintage Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-kafka Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-liquibase Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-logback Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-oauth2-client Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-oauth2-resource-server Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-parent-context Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-profile Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-property-validation Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-quartz Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-reactive-oauth2-client Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-reactive-oauth2-resource-server Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-rsocket Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-saml2-service-provider Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-secure Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-secure-jersey Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-secure-webflux Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-servlet Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-session Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-session-webflux Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-simple Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-test Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-test-nomockito Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-testng Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-tomcat Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-tomcat-jsp Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-tomcat-multi-connectors Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-tomcat-ssl Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-traditional Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-undertow Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-undertow-ssl Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-war Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-freemarker Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-groovy-templates Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-jsp Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-method-security Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-mustache Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-secure Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-secure-custom Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-secure-jdbc Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-static Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-web-ui Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-webflux Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-webflux-coroutines Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-webservices Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-websocket-jetty Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-websocket-tomcat Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-websocket-undertow Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00
spring-boot-smoke-test-xml Add junit-platform-launcher dependency by convention 2021-02-02 13:03:21 +00:00