@Test public void shutdownEndpointEnabled() { this.applicationContext.register(RootConfig.class, BaseConfiguration.class, ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.applicationContext, "endpoints.shutdown.enabled:true"); this.applicationContext.refresh(); assertThat(this.applicationContext.getBeansOfType(ShutdownMvcEndpoint.class)) .hasSize(1); }
@Test public void shutdownEndpointEnabled() { this.applicationContext.register(RootConfig.class, BaseConfiguration.class, ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.applicationContext, "endpoints.shutdown.enabled:true"); this.applicationContext.refresh(); assertThat( this.applicationContext.getBeansOfType(ShutdownMvcEndpoint.class).size(), is(equalTo(1))); }
@Bean @ConditionalOnBean(ShutdownEndpoint.class) @ConditionalOnEnabledEndpoint(value = "shutdown", enabledByDefault = false) public ShutdownMvcEndpoint shutdownMvcEndpoint(ShutdownEndpoint delegate) { return new ShutdownMvcEndpoint(delegate); }