Merge pull request #11805 from izeye:polish-20180127

* pr/11805:
  Polish
pull/11809/merge
Stephane Nicoll 7 years ago
commit 6830ad7892

@ -124,7 +124,7 @@ public class WebEndpointAutoConfiguration {
} }
@Bean @Bean
public ExposeExcludePropertyEndpointFilter<ExposableWebEndpoint> webIncludeExcludePropertyEndpointFilter() { public ExposeExcludePropertyEndpointFilter<ExposableWebEndpoint> webExposeExcludePropertyEndpointFilter() {
Set<String> expose = this.properties.getExpose(); Set<String> expose = this.properties.getExpose();
Set<String> exclude = this.properties.getExclude(); Set<String> exclude = this.properties.getExclude();
return new ExposeExcludePropertyEndpointFilter<>(ExposableWebEndpoint.class, return new ExposeExcludePropertyEndpointFilter<>(ExposableWebEndpoint.class,
@ -132,7 +132,7 @@ public class WebEndpointAutoConfiguration {
} }
@Bean @Bean
public ExposeExcludePropertyEndpointFilter<ExposableControllerEndpoint> controllerIncludeExcludePropertyEndpointFilter() { public ExposeExcludePropertyEndpointFilter<ExposableControllerEndpoint> controllerExposeExcludePropertyEndpointFilter() {
Set<String> expose = this.properties.getExpose(); Set<String> expose = this.properties.getExpose();
Set<String> exclude = this.properties.getExclude(); Set<String> exclude = this.properties.getExclude();
return new ExposeExcludePropertyEndpointFilter<>( return new ExposeExcludePropertyEndpointFilter<>(

@ -82,8 +82,8 @@ public class WebEndpointAutoConfigurationTests {
public void webApplicationConfiguresExposeExcludePropertyEndpointFilter() { public void webApplicationConfiguresExposeExcludePropertyEndpointFilter() {
this.contextRunner.run((context) -> assertThat(context) this.contextRunner.run((context) -> assertThat(context)
.getBeans(ExposeExcludePropertyEndpointFilter.class) .getBeans(ExposeExcludePropertyEndpointFilter.class)
.containsKeys("webIncludeExcludePropertyEndpointFilter", .containsKeys("webExposeExcludePropertyEndpointFilter",
"controllerIncludeExcludePropertyEndpointFilter")); "controllerExposeExcludePropertyEndpointFilter"));
} }
@Test @Test

@ -32,7 +32,6 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebApplicationContext; import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebApplicationContext;
import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.authentication.TestingAuthenticationToken;
@ -75,7 +74,6 @@ public class ControllerEndpointWebFluxIntegrationTests {
ReactiveManagementContextAutoConfiguration.class, ReactiveManagementContextAutoConfiguration.class,
AuditAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, AuditAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
WebFluxAutoConfiguration.class, ManagementContextAutoConfiguration.class, WebFluxAutoConfiguration.class, ManagementContextAutoConfiguration.class,
AuditAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
BeansEndpointAutoConfiguration.class }) BeansEndpointAutoConfiguration.class })
static class DefaultConfiguration { static class DefaultConfiguration {

@ -108,7 +108,7 @@ public class ControllerEndpointWebMvcIntegrationTests {
WebEndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
ServletManagementContextAutoConfiguration.class, AuditAutoConfiguration.class, ServletManagementContextAutoConfiguration.class, AuditAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementContextAutoConfiguration.class, AuditAutoConfiguration.class, ManagementContextAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
BeansEndpointAutoConfiguration.class }) BeansEndpointAutoConfiguration.class })
static class DefaultConfiguration { static class DefaultConfiguration {

@ -52,7 +52,7 @@ public abstract class AbstractDiscoveredEndpoint<O extends Operation>
Collection<? extends O> operations) { Collection<? extends O> operations) {
super(id, enabledByDefault, operations); super(id, enabledByDefault, operations);
Assert.notNull(discoverer, "Discoverer must not be null"); Assert.notNull(discoverer, "Discoverer must not be null");
Assert.notNull(discoverer, "EndpointBean must not be null"); Assert.notNull(endpointBean, "EndpointBean must not be null");
this.discoverer = discoverer; this.discoverer = discoverer;
this.endpointBean = endpointBean; this.endpointBean = endpointBean;
} }

@ -273,10 +273,10 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
/** /**
* Determine if an endpoint bean should be exposed. Subclasses can override this * Determine if an endpoint bean should be exposed. Subclasses can override this
* method to provide additional logic. * method to provide additional logic.
* @param extensionBean the extension bean * @param endpointBean the endpoint bean
* @return {@code true} if the extension is exposed * @return {@code true} if the endpoint is exposed
*/ */
protected boolean isEndpointExposed(Object extensionBean) { protected boolean isEndpointExposed(Object endpointBean) {
return true; return true;
} }

@ -61,7 +61,7 @@ import org.springframework.web.util.DefaultUriBuilderFactory;
*/ */
public class ControllerEndpointHandlerMappingIntegrationTests { public class ControllerEndpointHandlerMappingIntegrationTests {
public ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner( private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner(
AnnotationConfigReactiveWebServerApplicationContext::new) AnnotationConfigReactiveWebServerApplicationContext::new)
.withUserConfiguration(EndpointConfiguration.class, .withUserConfiguration(EndpointConfiguration.class,
ExampleWebFluxEndpoint.class); ExampleWebFluxEndpoint.class);

@ -60,7 +60,7 @@ import org.springframework.web.util.DefaultUriBuilderFactory;
*/ */
public class ControllerEndpointHandlerMappingIntegrationTests { public class ControllerEndpointHandlerMappingIntegrationTests {
public WebApplicationContextRunner contextRunner = new WebApplicationContextRunner( private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner(
AnnotationConfigServletWebServerApplicationContext::new) AnnotationConfigServletWebServerApplicationContext::new)
.withUserConfiguration(EndpointConfiguration.class, .withUserConfiguration(EndpointConfiguration.class,
ExampleMvcEndpoint.class); ExampleMvcEndpoint.class);

@ -33,7 +33,7 @@ public class RabbitMetricsTests {
@Test @Test
public void connectionFactoryIsInstrumented() { public void connectionFactoryIsInstrumented() {
ConnectionFactory connectionFactory = mockConnectionFactory(); ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
SimpleMeterRegistry registry = new SimpleMeterRegistry(); SimpleMeterRegistry registry = new SimpleMeterRegistry();
new RabbitMetrics(connectionFactory, "rabbit", null).bindTo(registry); new RabbitMetrics(connectionFactory, "rabbit", null).bindTo(registry);
registry.get("rabbit.connections"); registry.get("rabbit.connections");
@ -41,7 +41,7 @@ public class RabbitMetricsTests {
@Test @Test
public void connectionFactoryWithTagsIsInstrumented() { public void connectionFactoryWithTagsIsInstrumented() {
ConnectionFactory connectionFactory = mockConnectionFactory(); ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
SimpleMeterRegistry registry = new SimpleMeterRegistry(); SimpleMeterRegistry registry = new SimpleMeterRegistry();
new RabbitMetrics(connectionFactory, "test", Tags.of("env", "prod")) new RabbitMetrics(connectionFactory, "test", Tags.of("env", "prod"))
.bindTo(registry); .bindTo(registry);
@ -50,8 +50,4 @@ public class RabbitMetricsTests {
assertThat(registry.find("test.connections").tags("env", "dev").meter()).isNull(); assertThat(registry.find("test.connections").tags("env", "dev").meter()).isNull();
} }
private ConnectionFactory mockConnectionFactory() {
return mock(ConnectionFactory.class);
}
} }

@ -193,7 +193,7 @@ public abstract class AbstractErrorWebExceptionHandler
Date timestamp = (Date) error.get("timestamp"); Date timestamp = (Date) error.get("timestamp");
builder.append("<html><body><h1>Whitelabel Error Page</h1>") builder.append("<html><body><h1>Whitelabel Error Page</h1>")
.append("<p>This application has no configured error view, so you are seeing this as a fallback.</p>") .append("<p>This application has no configured error view, so you are seeing this as a fallback.</p>")
.append("<div id='created'>").append(timestamp.toString()) .append("<div id='created'>").append(timestamp)
.append("</div>").append("<div>There was an unexpected error (type=") .append("</div>").append("<div>There was an unexpected error (type=")
.append(htmlEscape(error.get("error"))).append(", status=") .append(htmlEscape(error.get("error"))).append(", status=")
.append(htmlEscape(error.get("status"))).append(").</div>"); .append(htmlEscape(error.get("status"))).append(").</div>");

@ -1365,8 +1365,8 @@ content into your application. Rather, pick only the properties that you need.
management.metrics.export.statsd.polling-frequency=10s # How often gauges will be polled. When a gauge is polled, its value is recalculated and if the value has changed, it is sent to the StatsD server. management.metrics.export.statsd.polling-frequency=10s # How often gauges will be polled. When a gauge is polled, its value is recalculated and if the value has changed, it is sent to the StatsD server.
management.metrics.export.statsd.port=8125 # Port of the StatsD server to receive exported metrics. management.metrics.export.statsd.port=8125 # Port of the StatsD server to receive exported metrics.
management.metrics.export.statsd.queue-size=2147483647 # Maximum size of the queue of items waiting to be sent to the StatsD server. management.metrics.export.statsd.queue-size=2147483647 # Maximum size of the queue of items waiting to be sent to the StatsD server.
management.metrics.jdbc.metric-name=data.source # Name of the metric for data source usage.
management.metrics.jdbc.instrument=true # Instrument all available data sources. management.metrics.jdbc.instrument=true # Instrument all available data sources.
management.metrics.jdbc.metric-name=data.source # Name of the metric for data source usage.
management.metrics.rabbitmq.instrument=true # Instrument all available connection factories. management.metrics.rabbitmq.instrument=true # Instrument all available connection factories.
management.metrics.rabbitmq.metric-name=rabbitmq # Name of the metric for RabbitMQ usage. management.metrics.rabbitmq.metric-name=rabbitmq # Name of the metric for RabbitMQ usage.
management.metrics.use-global-registry=true # Whether auto-configured MeterRegistry implementations should be bound to the global static registry on Metrics. management.metrics.use-global-registry=true # Whether auto-configured MeterRegistry implementations should be bound to the global static registry on Metrics.

@ -2140,7 +2140,7 @@ one and mark its `@Bean` as `@FlywayDataSource`. If you do so and want two data
remember to create another one and mark it as `@Primary`. Alternatively, you can use remember to create another one and mark it as `@Primary`. Alternatively, you can use
Flyway's native `DataSource` by setting `spring.flyway.[url,user,password]` Flyway's native `DataSource` by setting `spring.flyway.[url,user,password]`
in external properties. Setting either `spring.flyway.url` or `spring.flyway.user` in external properties. Setting either `spring.flyway.url` or `spring.flyway.user`
is sufficent to cause Flyway to use its own `DataSource`. If any of the three is sufficient to cause Flyway to use its own `DataSource`. If any of the three
properties has not be set, the value of its equivalent `spring.datasource` property will properties has not be set, the value of its equivalent `spring.datasource` property will
be used. be used.
@ -2179,7 +2179,7 @@ mark its `@Bean` as `@LiquibaseDataSource`. If you do so and you want two data s
remember to create another one and mark it as `@Primary`. Alternatively, you can use remember to create another one and mark it as `@Primary`. Alternatively, you can use
Liquibase's native `DataSource` by setting `spring.liquibase.[url,user,password]` in Liquibase's native `DataSource` by setting `spring.liquibase.[url,user,password]` in
external properties. Setting either `spring.liquibase.url` or `spring.liquibase.user` external properties. Setting either `spring.liquibase.url` or `spring.liquibase.user`
is sufficent to cause Liquibase to use its own `DataSource`. If any of the three is sufficient to cause Liquibase to use its own `DataSource`. If any of the three
properties has not be set, the value of its equivalent `spring.datasource` property will properties has not be set, the value of its equivalent `spring.datasource` property will
be used. be used.

@ -66,6 +66,7 @@ public interface SpringApplicationRunListener {
* {@link CommandLineRunner CommandLineRunners} and {@link ApplicationRunner * {@link CommandLineRunner CommandLineRunners} and {@link ApplicationRunner
* ApplicationRunners} have not been called. * ApplicationRunners} have not been called.
* @param context the application context. * @param context the application context.
* @since 2.0.0
*/ */
void started(ConfigurableApplicationContext context); void started(ConfigurableApplicationContext context);

Loading…
Cancel
Save