Unify method visibility of private classes
Apply checkstyle rule to ensure that private and package private classes do not have unnecessary public methods. Test classes have also been unified as much as possible to use default scoped inner-classes. Closes gh-7316
This commit is contained in:
parent
0a02a3a19c
commit
a66c4d3096
|
@ -155,7 +155,7 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
|
|||
static class IgnoredPathsSecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
public WebFilterChainPostProcessor webFilterChainPostProcessor() {
|
||||
WebFilterChainPostProcessor webFilterChainPostProcessor() {
|
||||
return new WebFilterChainPostProcessor();
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,7 @@ class ReactiveCloudFoundrySecurityService {
|
|||
* @return a Mono of the access level that should be granted
|
||||
* @throws CloudFoundryAuthorizationException if the token is not authorized
|
||||
*/
|
||||
public Mono<AccessLevel> getAccessLevel(String token, String applicationId)
|
||||
throws CloudFoundryAuthorizationException {
|
||||
Mono<AccessLevel> getAccessLevel(String token, String applicationId) throws CloudFoundryAuthorizationException {
|
||||
String uri = getPermissionsUri(applicationId);
|
||||
return this.webClient.get().uri(uri).header("Authorization", "bearer " + token).retrieve().bodyToMono(Map.class)
|
||||
.map(this::getAccessLevel).onErrorMap(this::mapError);
|
||||
|
@ -118,7 +117,7 @@ class ReactiveCloudFoundrySecurityService {
|
|||
* Return a Mono of all token keys known by the UAA.
|
||||
* @return a Mono of token keys
|
||||
*/
|
||||
public Mono<Map<String, String>> fetchTokenKeys() {
|
||||
Mono<Map<String, String>> fetchTokenKeys() {
|
||||
return getUaaUrl().flatMap(this::fetchTokenKeys);
|
||||
}
|
||||
|
||||
|
@ -141,7 +140,7 @@ class ReactiveCloudFoundrySecurityService {
|
|||
* Return a Mono of URL of the UAA.
|
||||
* @return the UAA url Mono
|
||||
*/
|
||||
public Mono<String> getUaaUrl() {
|
||||
Mono<String> getUaaUrl() {
|
||||
this.uaaUrl = this.webClient.get().uri(this.cloudControllerUrl + "/info").retrieve().bodyToMono(Map.class)
|
||||
.map((response) -> (String) response.get("token_endpoint")).cache()
|
||||
.onErrorMap((ex) -> new CloudFoundryAuthorizationException(Reason.SERVICE_UNAVAILABLE,
|
||||
|
|
|
@ -50,7 +50,7 @@ class ReactiveTokenValidator {
|
|||
this.securityService = securityService;
|
||||
}
|
||||
|
||||
public Mono<Void> validate(Token token) {
|
||||
Mono<Void> validate(Token token) {
|
||||
return validateAlgorithm(token).then(validateKeyIdAndSignature(token)).then(validateExpiry(token))
|
||||
.then(validateIssuer(token)).then(validateAudience(token));
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class CloudFoundrySecurityService {
|
|||
* @return the access level that should be granted
|
||||
* @throws CloudFoundryAuthorizationException if the token is not authorized
|
||||
*/
|
||||
public AccessLevel getAccessLevel(String token, String applicationId) throws CloudFoundryAuthorizationException {
|
||||
AccessLevel getAccessLevel(String token, String applicationId) throws CloudFoundryAuthorizationException {
|
||||
try {
|
||||
URI uri = getPermissionsUri(applicationId);
|
||||
RequestEntity<?> request = RequestEntity.get(uri).header("Authorization", "bearer " + token).build();
|
||||
|
@ -99,7 +99,7 @@ class CloudFoundrySecurityService {
|
|||
* Return all token keys known by the UAA.
|
||||
* @return a list of token keys
|
||||
*/
|
||||
public Map<String, String> fetchTokenKeys() {
|
||||
Map<String, String> fetchTokenKeys() {
|
||||
try {
|
||||
return extractTokenKeys(this.restTemplate.getForObject(getUaaUrl() + "/token_keys", Map.class));
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class CloudFoundrySecurityService {
|
|||
* Return the URL of the UAA.
|
||||
* @return the UAA url
|
||||
*/
|
||||
public String getUaaUrl() {
|
||||
String getUaaUrl() {
|
||||
if (this.uaaUrl == null) {
|
||||
try {
|
||||
Map<?, ?> response = this.restTemplate.getForObject(this.cloudControllerUrl + "/info", Map.class);
|
||||
|
|
|
@ -46,7 +46,7 @@ class TokenValidator {
|
|||
this.securityService = cloudFoundrySecurityService;
|
||||
}
|
||||
|
||||
public void validate(Token token) {
|
||||
void validate(Token token) {
|
||||
validateAlgorithm(token);
|
||||
validateKeyIdAndSignature(token);
|
||||
validateExpiry(token);
|
||||
|
|
|
@ -136,7 +136,7 @@ public class WebEndpointAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(ServletEndpointsSupplier.class)
|
||||
public ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext,
|
||||
ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext,
|
||||
ObjectProvider<PathMapper> endpointPathMappers,
|
||||
ObjectProvider<EndpointFilter<ExposableServletEndpoint>> filters) {
|
||||
return new ServletEndpointDiscoverer(applicationContext,
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.springframework.context.annotation.Bean;
|
|||
class JerseyWebEndpointManagementContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public ResourceConfigCustomizer webEndpointRegistrar(WebEndpointsSupplier webEndpointsSupplier,
|
||||
ResourceConfigCustomizer webEndpointRegistrar(WebEndpointsSupplier webEndpointsSupplier,
|
||||
ServletEndpointsSupplier servletEndpointsSupplier, EndpointMediaTypes endpointMediaTypes,
|
||||
WebEndpointProperties webEndpointProperties) {
|
||||
List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
|
||||
|
|
|
@ -38,7 +38,7 @@ class HealthEndpointConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HealthEndpoint healthEndpoint(HealthAggregator healthAggregator, HealthIndicatorRegistry registry) {
|
||||
HealthEndpoint healthEndpoint(HealthAggregator healthAggregator, HealthIndicatorRegistry registry) {
|
||||
return new HealthEndpoint(new CompositeHealthIndicator(healthAggregator, registry));
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class HealthEndpointWebExtensionConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HealthStatusHttpMapper createHealthStatusHttpMapper(HealthIndicatorProperties healthIndicatorProperties) {
|
||||
HealthStatusHttpMapper createHealthStatusHttpMapper(HealthIndicatorProperties healthIndicatorProperties) {
|
||||
HealthStatusHttpMapper statusHttpMapper = new HealthStatusHttpMapper();
|
||||
if (healthIndicatorProperties.getHttpMapping() != null) {
|
||||
statusHttpMapper.addStatusMapping(healthIndicatorProperties.getHttpMapping());
|
||||
|
@ -58,7 +58,7 @@ class HealthEndpointWebExtensionConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HealthWebEndpointResponseMapper healthWebEndpointResponseMapper(HealthStatusHttpMapper statusHttpMapper,
|
||||
HealthWebEndpointResponseMapper healthWebEndpointResponseMapper(HealthStatusHttpMapper statusHttpMapper,
|
||||
HealthEndpointProperties properties) {
|
||||
return new HealthWebEndpointResponseMapper(statusHttpMapper, properties.getShowDetails(),
|
||||
properties.getRoles());
|
||||
|
@ -72,7 +72,7 @@ class HealthEndpointWebExtensionConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(HealthEndpoint.class)
|
||||
public ReactiveHealthEndpointWebExtension reactiveHealthEndpointWebExtension(
|
||||
ReactiveHealthEndpointWebExtension reactiveHealthEndpointWebExtension(
|
||||
ObjectProvider<HealthAggregator> healthAggregator, ReactiveHealthIndicatorRegistry registry,
|
||||
HealthWebEndpointResponseMapper responseMapper) {
|
||||
return new ReactiveHealthEndpointWebExtension(new CompositeReactiveHealthIndicator(
|
||||
|
@ -88,7 +88,7 @@ class HealthEndpointWebExtensionConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(HealthEndpoint.class)
|
||||
public HealthEndpointWebExtension healthEndpointWebExtension(HealthEndpoint healthEndpoint,
|
||||
HealthEndpointWebExtension healthEndpointWebExtension(HealthEndpoint healthEndpoint,
|
||||
HealthWebEndpointResponseMapper responseMapper) {
|
||||
return new HealthEndpointWebExtension(healthEndpoint, responseMapper);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class HealthIndicatorAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ReactiveHealthIndicatorRegistry reactiveHealthIndicatorRegistry(
|
||||
ReactiveHealthIndicatorRegistry reactiveHealthIndicatorRegistry(
|
||||
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
|
||||
Map<String, HealthIndicator> healthIndicators) {
|
||||
return new ReactiveHealthIndicatorRegistryFactory()
|
||||
|
|
|
@ -37,7 +37,7 @@ final class HealthIndicatorRegistryBeans {
|
|||
private HealthIndicatorRegistryBeans() {
|
||||
}
|
||||
|
||||
public static HealthIndicatorRegistry get(ApplicationContext applicationContext) {
|
||||
static HealthIndicatorRegistry get(ApplicationContext applicationContext) {
|
||||
Map<String, HealthIndicator> indicators = new LinkedHashMap<>();
|
||||
indicators.putAll(applicationContext.getBeansOfType(HealthIndicator.class));
|
||||
if (ClassUtils.isPresent("reactor.core.publisher.Flux", null)) {
|
||||
|
@ -49,7 +49,7 @@ final class HealthIndicatorRegistryBeans {
|
|||
|
||||
private static class ReactiveHealthIndicators {
|
||||
|
||||
public Map<String, HealthIndicator> get(ApplicationContext applicationContext) {
|
||||
Map<String, HealthIndicator> get(ApplicationContext applicationContext) {
|
||||
Map<String, HealthIndicator> indicators = new LinkedHashMap<>();
|
||||
applicationContext.getBeansOfType(ReactiveHealthIndicator.class)
|
||||
.forEach((name, indicator) -> indicators.put(name, adapt(indicator)));
|
||||
|
|
|
@ -42,7 +42,7 @@ class CompositeMeterRegistryConfiguration {
|
|||
|
||||
@Bean
|
||||
@Primary
|
||||
public CompositeMeterRegistry compositeMeterRegistry(Clock clock, List<MeterRegistry> registries) {
|
||||
CompositeMeterRegistry compositeMeterRegistry(Clock clock, List<MeterRegistry> registries) {
|
||||
return new CompositeMeterRegistry(clock, registries);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -29,8 +29,9 @@ import org.springframework.boot.convert.DurationStyle;
|
|||
* {@link Duration} (applicable to only timers).
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 2.2.0
|
||||
*/
|
||||
final class MeterValue {
|
||||
public final class MeterValue {
|
||||
|
||||
private final Object value;
|
||||
|
||||
|
@ -43,8 +44,7 @@ final class MeterValue {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the underlying value of the SLA in form suitable to apply to the given meter
|
||||
* type.
|
||||
* Return the underlying value in form suitable to apply to the given meter type.
|
||||
* @param meterType the meter type
|
||||
* @return the value or {@code null} if the value cannot be applied
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
class NoOpMeterRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public CompositeMeterRegistry noOpMeterRegistry(Clock clock) {
|
||||
CompositeMeterRegistry noOpMeterRegistry(Clock clock) {
|
||||
return new CompositeMeterRegistry(clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class CacheMeterBinderProvidersConfiguration {
|
|||
static class CaffeineCacheMeterBinderProviderConfiguration {
|
||||
|
||||
@Bean
|
||||
public CaffeineCacheMeterBinderProvider caffeineCacheMeterBinderProvider() {
|
||||
CaffeineCacheMeterBinderProvider caffeineCacheMeterBinderProvider() {
|
||||
return new CaffeineCacheMeterBinderProvider();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class CacheMeterBinderProvidersConfiguration {
|
|||
static class EhCache2CacheMeterBinderProviderConfiguration {
|
||||
|
||||
@Bean
|
||||
public EhCache2CacheMeterBinderProvider ehCache2CacheMeterBinderProvider() {
|
||||
EhCache2CacheMeterBinderProvider ehCache2CacheMeterBinderProvider() {
|
||||
return new EhCache2CacheMeterBinderProvider();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class CacheMeterBinderProvidersConfiguration {
|
|||
static class HazelcastCacheMeterBinderProviderConfiguration {
|
||||
|
||||
@Bean
|
||||
public HazelcastCacheMeterBinderProvider hazelcastCacheMeterBinderProvider() {
|
||||
HazelcastCacheMeterBinderProvider hazelcastCacheMeterBinderProvider() {
|
||||
return new HazelcastCacheMeterBinderProvider();
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ class CacheMeterBinderProvidersConfiguration {
|
|||
static class JCacheCacheMeterBinderProviderConfiguration {
|
||||
|
||||
@Bean
|
||||
public JCacheCacheMeterBinderProvider jCacheCacheMeterBinderProvider() {
|
||||
JCacheCacheMeterBinderProvider jCacheCacheMeterBinderProvider() {
|
||||
return new JCacheCacheMeterBinderProvider();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,12 +59,12 @@ class CacheMetricsRegistrarConfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public CacheMetricsRegistrar cacheMetricsRegistrar() {
|
||||
CacheMetricsRegistrar cacheMetricsRegistrar() {
|
||||
return this.cacheMetricsRegistrar;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void bindCachesToRegistry() {
|
||||
void bindCachesToRegistry() {
|
||||
this.cacheManagers.forEach(this::bindCacheManagerToRegistry);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class DataSourcePoolMetricsAutoConfiguration {
|
|||
private static final String DATASOURCE_SUFFIX = "dataSource";
|
||||
|
||||
@Autowired
|
||||
public void bindDataSourcesToRegistry(Map<String, DataSource> dataSources, MeterRegistry registry,
|
||||
void bindDataSourcesToRegistry(Map<String, DataSource> dataSources, MeterRegistry registry,
|
||||
ObjectProvider<DataSourcePoolMetadataProvider> metadataProviders) {
|
||||
List<DataSourcePoolMetadataProvider> metadataProvidersList = metadataProviders.stream()
|
||||
.collect(Collectors.toList());
|
||||
|
@ -109,7 +109,7 @@ public class DataSourcePoolMetricsAutoConfiguration {
|
|||
}
|
||||
|
||||
@Autowired
|
||||
public void bindMetricsRegistryToHikariDataSources(Collection<DataSource> dataSources) {
|
||||
void bindMetricsRegistryToHikariDataSources(Collection<DataSource> dataSources) {
|
||||
for (DataSource dataSource : dataSources) {
|
||||
HikariDataSource hikariDataSource = DataSourceUnwrapper.unwrap(dataSource, HikariDataSource.class);
|
||||
if (hikariDataSource != null) {
|
||||
|
|
|
@ -45,12 +45,12 @@ class RestTemplateMetricsConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(RestTemplateExchangeTagsProvider.class)
|
||||
public DefaultRestTemplateExchangeTagsProvider restTemplateExchangeTagsProvider() {
|
||||
DefaultRestTemplateExchangeTagsProvider restTemplateExchangeTagsProvider() {
|
||||
return new DefaultRestTemplateExchangeTagsProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MetricsRestTemplateCustomizer metricsRestTemplateCustomizer(MeterRegistry meterRegistry,
|
||||
MetricsRestTemplateCustomizer metricsRestTemplateCustomizer(MeterRegistry meterRegistry,
|
||||
RestTemplateExchangeTagsProvider restTemplateExchangeTagsProvider, MetricsProperties properties) {
|
||||
ClientRequest request = properties.getWeb().getClient().getRequest();
|
||||
return new MetricsRestTemplateCustomizer(meterRegistry, restTemplateExchangeTagsProvider,
|
||||
|
|
|
@ -41,12 +41,12 @@ class WebClientMetricsConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public WebClientExchangeTagsProvider defaultWebClientExchangeTagsProvider() {
|
||||
WebClientExchangeTagsProvider defaultWebClientExchangeTagsProvider() {
|
||||
return new DefaultWebClientExchangeTagsProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MetricsWebClientCustomizer metricsWebClientCustomizer(MeterRegistry meterRegistry,
|
||||
MetricsWebClientCustomizer metricsWebClientCustomizer(MeterRegistry meterRegistry,
|
||||
WebClientExchangeTagsProvider tagsProvider, MetricsProperties properties) {
|
||||
ClientRequest request = properties.getWeb().getClient().getRequest();
|
||||
return new MetricsWebClientCustomizer(meterRegistry, tagsProvider, request.getMetricName(),
|
||||
|
|
|
@ -299,7 +299,7 @@ public final class EndpointRequest {
|
|||
*/
|
||||
private static class RequestMatcherFactory {
|
||||
|
||||
public RequestMatcher antPath(RequestMatcherProvider matcherProvider, String... parts) {
|
||||
RequestMatcher antPath(RequestMatcherProvider matcherProvider, String... parts) {
|
||||
StringBuilder pattern = new StringBuilder();
|
||||
for (String part : parts) {
|
||||
pattern.append(part);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class HttpTraceAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HttpTraceFilter httpTraceFilter(HttpTraceRepository repository, HttpExchangeTracer tracer) {
|
||||
HttpTraceFilter httpTraceFilter(HttpTraceRepository repository, HttpExchangeTracer tracer) {
|
||||
return new HttpTraceFilter(repository, tracer);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class HttpTraceAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HttpTraceWebFilter httpTraceWebFilter(HttpTraceRepository repository, HttpExchangeTracer tracer,
|
||||
HttpTraceWebFilter httpTraceWebFilter(HttpTraceRepository repository, HttpExchangeTracer tracer,
|
||||
HttpTraceProperties traceProperties) {
|
||||
return new HttpTraceWebFilter(repository, tracer, traceProperties.getInclude());
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@ import org.springframework.context.annotation.Configuration;
|
|||
class JerseyManagementContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<ServletContainer> jerseyServletRegistration(
|
||||
JerseyApplicationPath jerseyApplicationPath, ResourceConfig resourceConfig) {
|
||||
ServletRegistrationBean<ServletContainer> jerseyServletRegistration(JerseyApplicationPath jerseyApplicationPath,
|
||||
ResourceConfig resourceConfig) {
|
||||
return new ServletRegistrationBean<>(new ServletContainer(resourceConfig),
|
||||
jerseyApplicationPath.getUrlMapping());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceConfig resourceConfig(ObjectProvider<ResourceConfigCustomizer> resourceConfigCustomizers) {
|
||||
ResourceConfig resourceConfig(ObjectProvider<ResourceConfigCustomizer> resourceConfigCustomizers) {
|
||||
ResourceConfig resourceConfig = new ResourceConfig();
|
||||
resourceConfigCustomizers.orderedStream().forEach((customizer) -> customizer.customize(resourceConfig));
|
||||
return resourceConfig;
|
||||
|
|
|
@ -89,7 +89,7 @@ public class MappingsEndpointAutoConfiguration {
|
|||
static class ReactiveWebConfiguration {
|
||||
|
||||
@Bean
|
||||
public DispatcherHandlersMappingDescriptionProvider dispatcherHandlerMappingDescriptionProvider() {
|
||||
DispatcherHandlersMappingDescriptionProvider dispatcherHandlerMappingDescriptionProvider() {
|
||||
return new DispatcherHandlersMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
|
|
|
@ -196,8 +196,7 @@ public class ManagementContextAutoConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
public static void addIfPossible(ApplicationContext parentContext,
|
||||
ConfigurableApplicationContext childContext) {
|
||||
static void addIfPossible(ApplicationContext parentContext, ConfigurableApplicationContext childContext) {
|
||||
if (parentContext instanceof ConfigurableApplicationContext) {
|
||||
add((ConfigurableApplicationContext) parentContext, childContext);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ class ManagementContextConfigurationImportSelector implements DeferredImportSele
|
|||
return (order != null) ? order : Ordered.LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
String getClassName() {
|
||||
return this.className;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ class ManagementContextConfigurationImportSelector implements DeferredImportSele
|
|||
return this.order;
|
||||
}
|
||||
|
||||
public ManagementContextType getContextType() {
|
||||
ManagementContextType getContextType() {
|
||||
return this.contextType;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,26 +73,26 @@ import org.springframework.util.StringUtils;
|
|||
class ServletManagementChildContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public ServletManagementWebServerFactoryCustomizer servletManagementWebServerFactoryCustomizer(
|
||||
ServletManagementWebServerFactoryCustomizer servletManagementWebServerFactoryCustomizer(
|
||||
ListableBeanFactory beanFactory) {
|
||||
return new ServletManagementWebServerFactoryCustomizer(beanFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnClass(name = "io.undertow.Undertow")
|
||||
public UndertowAccessLogCustomizer undertowManagementAccessLogCustomizer() {
|
||||
UndertowAccessLogCustomizer undertowManagementAccessLogCustomizer() {
|
||||
return new UndertowAccessLogCustomizer();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnClass(name = "org.apache.catalina.valves.AccessLogValve")
|
||||
public TomcatAccessLogCustomizer tomcatManagementAccessLogCustomizer() {
|
||||
TomcatAccessLogCustomizer tomcatManagementAccessLogCustomizer() {
|
||||
return new TomcatAccessLogCustomizer();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnClass(name = "org.eclipse.jetty.server.Server")
|
||||
public JettyAccessLogCustomizer jettyManagementAccessLogCustomizer() {
|
||||
JettyAccessLogCustomizer jettyManagementAccessLogCustomizer() {
|
||||
return new JettyAccessLogCustomizer();
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ class ServletManagementChildContextConfiguration {
|
|||
static class ServletManagementContextSecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
public Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) {
|
||||
Filter springSecurityFilterChain(HierarchicalBeanFactory beanFactory) {
|
||||
BeanFactory parent = beanFactory.getParentBeanFactory();
|
||||
return parent.getBean(BeanIds.SPRING_SECURITY_FILTER_CHAIN, Filter.class);
|
||||
}
|
||||
|
|
|
@ -56,12 +56,12 @@ class WebMvcEndpointChildContextConfiguration {
|
|||
*/
|
||||
@Bean
|
||||
@ConditionalOnBean(ErrorAttributes.class)
|
||||
public ManagementErrorEndpoint errorEndpoint(ErrorAttributes errorAttributes) {
|
||||
ManagementErrorEndpoint errorEndpoint(ErrorAttributes errorAttributes) {
|
||||
return new ManagementErrorEndpoint(errorAttributes);
|
||||
}
|
||||
|
||||
@Bean(name = DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)
|
||||
public DispatcherServlet dispatcherServlet() {
|
||||
DispatcherServlet dispatcherServlet() {
|
||||
DispatcherServlet dispatcherServlet = new DispatcherServlet();
|
||||
// Ensure the parent configuration does not leak down to us
|
||||
dispatcherServlet.setDetectAllHandlerAdapters(false);
|
||||
|
@ -72,28 +72,28 @@ class WebMvcEndpointChildContextConfiguration {
|
|||
}
|
||||
|
||||
@Bean(name = DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME)
|
||||
public DispatcherServletRegistrationBean dispatcherServletRegistrationBean(DispatcherServlet dispatcherServlet) {
|
||||
DispatcherServletRegistrationBean dispatcherServletRegistrationBean(DispatcherServlet dispatcherServlet) {
|
||||
return new DispatcherServletRegistrationBean(dispatcherServlet, "/");
|
||||
}
|
||||
|
||||
@Bean(name = DispatcherServlet.HANDLER_MAPPING_BEAN_NAME)
|
||||
public CompositeHandlerMapping compositeHandlerMapping() {
|
||||
CompositeHandlerMapping compositeHandlerMapping() {
|
||||
return new CompositeHandlerMapping();
|
||||
}
|
||||
|
||||
@Bean(name = DispatcherServlet.HANDLER_ADAPTER_BEAN_NAME)
|
||||
public CompositeHandlerAdapter compositeHandlerAdapter(ListableBeanFactory beanFactory) {
|
||||
CompositeHandlerAdapter compositeHandlerAdapter(ListableBeanFactory beanFactory) {
|
||||
return new CompositeHandlerAdapter(beanFactory);
|
||||
}
|
||||
|
||||
@Bean(name = DispatcherServlet.HANDLER_EXCEPTION_RESOLVER_BEAN_NAME)
|
||||
public CompositeHandlerExceptionResolver compositeHandlerExceptionResolver() {
|
||||
CompositeHandlerExceptionResolver compositeHandlerExceptionResolver() {
|
||||
return new CompositeHandlerExceptionResolver();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ RequestContextListener.class, RequestContextFilter.class })
|
||||
public RequestContextFilter requestContextFilter() {
|
||||
RequestContextFilter requestContextFilter() {
|
||||
return new OrderedRequestContextFilter();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
|
|||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.test.util.ApplicationContextTestUtils;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Test for application hierarchies created using {@link SpringApplicationBuilder}.
|
||||
|
@ -64,6 +65,7 @@ class SpringApplicationHierarchyTests {
|
|||
this.context = builder.run("--server.port=0", "--management.metrics.use-global-registry=false");
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(
|
||||
exclude = { ElasticsearchDataAutoConfiguration.class, ElasticsearchRepositoriesAutoConfiguration.class,
|
||||
CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class,
|
||||
|
@ -73,10 +75,11 @@ class SpringApplicationHierarchyTests {
|
|||
FlywayAutoConfiguration.class, MetricsAutoConfiguration.class },
|
||||
excludeName = {
|
||||
"org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
|
||||
public static class Child {
|
||||
static class Parent {
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration(
|
||||
exclude = { ElasticsearchDataAutoConfiguration.class, ElasticsearchRepositoriesAutoConfiguration.class,
|
||||
CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class,
|
||||
|
@ -86,7 +89,7 @@ class SpringApplicationHierarchyTests {
|
|||
FlywayAutoConfiguration.class, MetricsAutoConfiguration.class },
|
||||
excludeName = {
|
||||
"org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
|
||||
public static class Parent {
|
||||
static class Child {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -97,30 +97,30 @@ class AuditAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class CustomAuditEventRepositoryConfiguration {
|
||||
static class CustomAuditEventRepositoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestAuditEventRepository testAuditEventRepository() {
|
||||
TestAuditEventRepository testAuditEventRepository() {
|
||||
return new TestAuditEventRepository();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class TestAuditEventRepository extends InMemoryAuditEventRepository {
|
||||
static class TestAuditEventRepository extends InMemoryAuditEventRepository {
|
||||
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
protected static class CustomAuthenticationAuditListenerConfiguration {
|
||||
static class CustomAuthenticationAuditListenerConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestAuthenticationAuditListener authenticationAuditListener() {
|
||||
TestAuthenticationAuditListener authenticationAuditListener() {
|
||||
return new TestAuthenticationAuditListener();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static class TestAuthenticationAuditListener extends AbstractAuthenticationAuditListener {
|
||||
static class TestAuthenticationAuditListener extends AbstractAuthenticationAuditListener {
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
|
||||
|
@ -133,16 +133,16 @@ class AuditAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
protected static class CustomAuthorizationAuditListenerConfiguration {
|
||||
static class CustomAuthorizationAuditListenerConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestAuthorizationAuditListener authorizationAuditListener() {
|
||||
TestAuthorizationAuditListener authorizationAuditListener() {
|
||||
return new TestAuthorizationAuditListener();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static class TestAuthorizationAuditListener extends AbstractAuthorizationAuditListener {
|
||||
static class TestAuthorizationAuditListener extends AbstractAuthorizationAuditListener {
|
||||
|
||||
@Override
|
||||
public void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
|
||||
|
@ -155,16 +155,16 @@ class AuditAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
protected static class CustomAuditListenerConfiguration {
|
||||
static class CustomAuditListenerConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestAuditListener testAuditListener() {
|
||||
TestAuditListener testAuditListener() {
|
||||
return new TestAuditListener();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static class TestAuditListener extends AbstractAuditListener {
|
||||
static class TestAuditListener extends AbstractAuditListener {
|
||||
|
||||
@Override
|
||||
protected void onAuditEvent(AuditEvent event) {
|
||||
|
|
|
@ -66,10 +66,10 @@ class AuditEventsEndpointAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class CustomAuditEventRepositoryConfiguration {
|
||||
static class CustomAuditEventRepositoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public InMemoryAuditEventRepository testAuditEventRepository() {
|
||||
InMemoryAuditEventRepository testAuditEventRepository() {
|
||||
return new InMemoryAuditEventRepository();
|
||||
}
|
||||
|
||||
|
|
|
@ -57,10 +57,10 @@ class CassandraHealthIndicatorAutoConfigurationTests {
|
|||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfigureBefore(CassandraHealthIndicatorAutoConfiguration.class)
|
||||
protected static class CassandraConfiguration {
|
||||
static class CassandraConfiguration {
|
||||
|
||||
@Bean
|
||||
public CassandraOperations cassandraOperations() {
|
||||
CassandraOperations cassandraOperations() {
|
||||
return mock(CassandraOperations.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,27 +99,27 @@ class CloudFoundryWebEndpointDiscovererTests {
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint() {
|
||||
TestEndpoint testEndpoint() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestEndpointWebExtension testEndpointWebExtension() {
|
||||
TestEndpointWebExtension testEndpointWebExtension() {
|
||||
return new TestEndpointWebExtension();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HealthEndpoint healthEndpoint() {
|
||||
HealthEndpoint healthEndpoint() {
|
||||
return new HealthEndpoint(mock(HealthIndicator.class));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HealthEndpointWebExtension healthEndpointWebExtension() {
|
||||
HealthEndpointWebExtension healthEndpointWebExtension() {
|
||||
return new HealthEndpointWebExtension();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestHealthEndpointCloudFoundryExtension testHealthEndpointCloudFoundryExtension() {
|
||||
TestHealthEndpointCloudFoundryExtension testHealthEndpointCloudFoundryExtension() {
|
||||
return new TestHealthEndpointCloudFoundryExtension();
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ class CloudFoundryWebEndpointDiscovererTests {
|
|||
static class TestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ class CloudFoundryWebEndpointDiscovererTests {
|
|||
static class TestEndpointWebExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ class CloudFoundryWebEndpointDiscovererTests {
|
|||
static class HealthEndpointWebExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ class CloudFoundryWebEndpointDiscovererTests {
|
|||
static class TestHealthEndpointCloudFoundryExtension {
|
||||
|
||||
@ReadOperation
|
||||
public Object getAll() {
|
||||
Object getAll() {
|
||||
return "cf";
|
||||
}
|
||||
|
||||
|
|
|
@ -165,18 +165,18 @@ class CloudFoundryWebFluxEndpointIntegrationTests {
|
|||
static class CloudFoundryReactiveConfiguration {
|
||||
|
||||
@Bean
|
||||
public CloudFoundrySecurityInterceptor interceptor() {
|
||||
CloudFoundrySecurityInterceptor interceptor() {
|
||||
return new CloudFoundrySecurityInterceptor(tokenValidator, securityService, "app-id");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EndpointMediaTypes EndpointMediaTypes() {
|
||||
EndpointMediaTypes EndpointMediaTypes() {
|
||||
return new EndpointMediaTypes(Collections.singletonList("application/json"),
|
||||
Collections.singletonList("application/json"));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CloudFoundryWebFluxEndpointHandlerMapping cloudFoundryWebEndpointServletHandlerMapping(
|
||||
CloudFoundryWebFluxEndpointHandlerMapping cloudFoundryWebEndpointServletHandlerMapping(
|
||||
WebEndpointDiscoverer webEndpointDiscoverer, EndpointMediaTypes endpointMediaTypes,
|
||||
CloudFoundrySecurityInterceptor interceptor) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
|
@ -188,7 +188,7 @@ class CloudFoundryWebFluxEndpointIntegrationTests {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public WebEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext,
|
||||
WebEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext,
|
||||
EndpointMediaTypes endpointMediaTypes) {
|
||||
ParameterValueMapper parameterMapper = new ConversionServiceParameterValueMapper(
|
||||
DefaultConversionService.getSharedInstance());
|
||||
|
@ -197,7 +197,7 @@ class CloudFoundryWebFluxEndpointIntegrationTests {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public EndpointDelegate endpointDelegate() {
|
||||
EndpointDelegate endpointDelegate() {
|
||||
return mock(EndpointDelegate.class);
|
||||
}
|
||||
|
||||
|
@ -213,17 +213,17 @@ class CloudFoundryWebFluxEndpointIntegrationTests {
|
|||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readAll() {
|
||||
Map<String, Object> readAll() {
|
||||
return Collections.singletonMap("All", true);
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readPart(@Selector String part) {
|
||||
Map<String, Object> readPart(@Selector String part) {
|
||||
return Collections.singletonMap("part", part);
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public void write(String foo, String bar) {
|
||||
void write(String foo, String bar) {
|
||||
this.endpointDelegate.write(foo, bar);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ class CloudFoundryWebFluxEndpointIntegrationTests {
|
|||
static class TestEnvEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readAll() {
|
||||
Map<String, Object> readAll() {
|
||||
return Collections.singletonMap("All", true);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ class CloudFoundryWebFluxEndpointIntegrationTests {
|
|||
static class TestInfoEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readAll() {
|
||||
Map<String, Object> readAll() {
|
||||
return Collections.singletonMap("All", true);
|
||||
}
|
||||
|
||||
|
@ -251,26 +251,26 @@ class CloudFoundryWebFluxEndpointIntegrationTests {
|
|||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(CloudFoundryReactiveConfiguration.class)
|
||||
protected static class TestEndpointConfiguration {
|
||||
static class TestEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint(EndpointDelegate endpointDelegate) {
|
||||
TestEndpoint testEndpoint(EndpointDelegate endpointDelegate) {
|
||||
return new TestEndpoint(endpointDelegate);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestInfoEndpoint testInfoEnvEndpoint() {
|
||||
TestInfoEndpoint testInfoEnvEndpoint() {
|
||||
return new TestInfoEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestEnvEndpoint testEnvEndpoint() {
|
||||
TestEnvEndpoint testEnvEndpoint() {
|
||||
return new TestEnvEndpoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface EndpointDelegate {
|
||||
interface EndpointDelegate {
|
||||
|
||||
void write();
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
|
|||
static class TestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String hello() {
|
||||
String hello() {
|
||||
return "hello world";
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
|
|||
static class WebClientCustomizerConfig {
|
||||
|
||||
@Bean
|
||||
public WebClientCustomizer webClientCustomizer() {
|
||||
WebClientCustomizer webClientCustomizer() {
|
||||
return mock(WebClientCustomizer.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ class CloudFoundryActuatorAutoConfigurationTests {
|
|||
static class TestEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public String hello() {
|
||||
String hello() {
|
||||
return "hello world";
|
||||
}
|
||||
|
||||
|
|
|
@ -162,18 +162,18 @@ class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
static class CloudFoundryMvcConfiguration {
|
||||
|
||||
@Bean
|
||||
public CloudFoundrySecurityInterceptor interceptor() {
|
||||
CloudFoundrySecurityInterceptor interceptor() {
|
||||
return new CloudFoundrySecurityInterceptor(tokenValidator, securityService, "app-id");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EndpointMediaTypes EndpointMediaTypes() {
|
||||
EndpointMediaTypes EndpointMediaTypes() {
|
||||
return new EndpointMediaTypes(Collections.singletonList("application/json"),
|
||||
Collections.singletonList("application/json"));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServletHandlerMapping(
|
||||
CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServletHandlerMapping(
|
||||
WebEndpointDiscoverer webEndpointDiscoverer, EndpointMediaTypes endpointMediaTypes,
|
||||
CloudFoundrySecurityInterceptor interceptor) {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
|
@ -185,7 +185,7 @@ class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public WebEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext,
|
||||
WebEndpointDiscoverer webEndpointDiscoverer(ApplicationContext applicationContext,
|
||||
EndpointMediaTypes endpointMediaTypes) {
|
||||
ParameterValueMapper parameterMapper = new ConversionServiceParameterValueMapper(
|
||||
DefaultConversionService.getSharedInstance());
|
||||
|
@ -194,17 +194,17 @@ class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public EndpointDelegate endpointDelegate() {
|
||||
EndpointDelegate endpointDelegate() {
|
||||
return mock(EndpointDelegate.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcat() {
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DispatcherServlet dispatcherServlet() {
|
||||
DispatcherServlet dispatcherServlet() {
|
||||
return new DispatcherServlet();
|
||||
}
|
||||
|
||||
|
@ -220,17 +220,17 @@ class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readAll() {
|
||||
Map<String, Object> readAll() {
|
||||
return Collections.singletonMap("All", true);
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readPart(@Selector String part) {
|
||||
Map<String, Object> readPart(@Selector String part) {
|
||||
return Collections.singletonMap("part", part);
|
||||
}
|
||||
|
||||
@WriteOperation
|
||||
public void write(String foo, String bar) {
|
||||
void write(String foo, String bar) {
|
||||
this.endpointDelegate.write(foo, bar);
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
static class TestEnvEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readAll() {
|
||||
Map<String, Object> readAll() {
|
||||
return Collections.singletonMap("All", true);
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
static class TestInfoEndpoint {
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> readAll() {
|
||||
Map<String, Object> readAll() {
|
||||
return Collections.singletonMap("All", true);
|
||||
}
|
||||
|
||||
|
@ -258,26 +258,26 @@ class CloudFoundryMvcWebEndpointIntegrationTests {
|
|||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Import(CloudFoundryMvcConfiguration.class)
|
||||
protected static class TestEndpointConfiguration {
|
||||
static class TestEndpointConfiguration {
|
||||
|
||||
@Bean
|
||||
public TestEndpoint testEndpoint(EndpointDelegate endpointDelegate) {
|
||||
TestEndpoint testEndpoint(EndpointDelegate endpointDelegate) {
|
||||
return new TestEndpoint(endpointDelegate);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestInfoEndpoint testInfoEnvEndpoint() {
|
||||
TestInfoEndpoint testInfoEnvEndpoint() {
|
||||
return new TestInfoEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TestEnvEndpoint testEnvEndpoint() {
|
||||
TestEnvEndpoint testEnvEndpoint() {
|
||||
return new TestEnvEndpoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface EndpointDelegate {
|
||||
interface EndpointDelegate {
|
||||
|
||||
void write();
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class ConditionsReportEndpointTests {
|
|||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Config {
|
||||
static class Config {
|
||||
|
||||
private final ConfigurableApplicationContext context;
|
||||
|
||||
|
@ -68,7 +68,7 @@ class ConditionsReportEndpointTests {
|
|||
}
|
||||
|
||||
@PostConstruct
|
||||
public void setupAutoConfigurationReport() {
|
||||
void setupAutoConfigurationReport() {
|
||||
ConditionEvaluationReport report = ConditionEvaluationReport.get(this.context.getBeanFactory());
|
||||
report.recordEvaluationCandidates(Arrays.asList("a", "b"));
|
||||
report.recordConditionEvaluation("a", mock(Condition.class), mock(ConditionOutcome.class));
|
||||
|
@ -76,7 +76,7 @@ class ConditionsReportEndpointTests {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public ConditionsReportEndpoint endpoint() {
|
||||
ConditionsReportEndpoint endpoint() {
|
||||
return new ConditionsReportEndpoint(this.context);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,17 +87,17 @@ class ConfigurationPropertiesReportEndpointAutoConfigurationTests {
|
|||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
public static class Config {
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public TestProperties testProperties() {
|
||||
TestProperties testProperties() {
|
||||
return new TestProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ConfigurationProperties("test")
|
||||
static class TestProperties {
|
||||
public static class TestProperties {
|
||||
|
||||
private String dbPassword = "123456";
|
||||
|
||||
|
|
|
@ -162,11 +162,11 @@ class ExposeExcludePropertyEndpointFilterTests {
|
|||
return ((EndpointFilter) this.filter).match(endpoint);
|
||||
}
|
||||
|
||||
private abstract static class TestExposableWebEndpoint implements ExposableWebEndpoint {
|
||||
abstract static class TestExposableWebEndpoint implements ExposableWebEndpoint {
|
||||
|
||||
}
|
||||
|
||||
private abstract static class DifferentTestExposableWebEndpoint implements ExposableWebEndpoint {
|
||||
abstract static class DifferentTestExposableWebEndpoint implements ExposableWebEndpoint {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -226,31 +226,31 @@ class ConditionalOnAvailableEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public HealthEndpoint health() {
|
||||
HealthEndpoint health() {
|
||||
return new HealthEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public InfoEndpoint info() {
|
||||
InfoEndpoint info() {
|
||||
return new InfoEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public SpringEndpoint spring() {
|
||||
SpringEndpoint spring() {
|
||||
return new SpringEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public TestEndpoint test() {
|
||||
TestEndpoint test() {
|
||||
return new TestEndpoint();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public ShutdownEndpoint shutdown() {
|
||||
ShutdownEndpoint shutdown() {
|
||||
return new ShutdownEndpoint();
|
||||
}
|
||||
|
||||
|
@ -261,13 +261,13 @@ class ConditionalOnAvailableEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint(endpoint = SpringEndpoint.class)
|
||||
public String springComponent() {
|
||||
String springComponent() {
|
||||
return "springComponent";
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public SpringEndpointExtension springExtension() {
|
||||
SpringEndpointExtension springExtension() {
|
||||
return new SpringEndpointExtension();
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ class ConditionalOnAvailableEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public String springcomp() {
|
||||
String springcomp() {
|
||||
return "springcomp";
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ class ConditionalOnEnabledEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public FooEndpointEnabledByDefaultTrue foo() {
|
||||
FooEndpointEnabledByDefaultTrue foo() {
|
||||
return new FooEndpointEnabledByDefaultTrue();
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ class ConditionalOnEnabledEndpointTests {
|
|||
static class FooEndpointEnabledByDefaultTrueOnConfigurationConfiguration {
|
||||
|
||||
@Bean
|
||||
public FooEndpointEnabledByDefaultTrue foo() {
|
||||
FooEndpointEnabledByDefaultTrue foo() {
|
||||
return new FooEndpointEnabledByDefaultTrue();
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ class ConditionalOnEnabledEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public FooEndpointEnabledByDefaultFalse foo() {
|
||||
FooEndpointEnabledByDefaultFalse foo() {
|
||||
return new FooEndpointEnabledByDefaultFalse();
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class ConditionalOnEnabledEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public FooBarEndpointEnabledByDefaultFalse fooBar() {
|
||||
FooBarEndpointEnabledByDefaultFalse fooBar() {
|
||||
return new FooBarEndpointEnabledByDefaultFalse();
|
||||
}
|
||||
|
||||
|
@ -223,13 +223,13 @@ class ConditionalOnEnabledEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public FooEndpointEnabledByDefaultTrue foo() {
|
||||
FooEndpointEnabledByDefaultTrue foo() {
|
||||
return new FooEndpointEnabledByDefaultTrue();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public FooEndpointExtensionEnabledByDefaultTrue fooExt() {
|
||||
FooEndpointExtensionEnabledByDefaultTrue fooExt() {
|
||||
return new FooEndpointExtensionEnabledByDefaultTrue();
|
||||
}
|
||||
|
||||
|
@ -240,13 +240,13 @@ class ConditionalOnEnabledEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public FooEndpointEnabledByDefaultFalse foo() {
|
||||
FooEndpointEnabledByDefaultFalse foo() {
|
||||
return new FooEndpointEnabledByDefaultFalse();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public FooEndpointExtensionEnabledByDefaultFalse fooExt() {
|
||||
FooEndpointExtensionEnabledByDefaultFalse fooExt() {
|
||||
return new FooEndpointExtensionEnabledByDefaultFalse();
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ class ConditionalOnEnabledEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint(endpoint = FooEndpointEnabledByDefaultTrue.class)
|
||||
public String fooComponent() {
|
||||
String fooComponent() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ class ConditionalOnEnabledEndpointTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledEndpoint
|
||||
public String fooComponent() {
|
||||
String fooComponent() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
|
|
|
@ -79,17 +79,17 @@ class ServletEndpointManagementContextConfigurationTests {
|
|||
static class TestConfig {
|
||||
|
||||
@Bean
|
||||
public ServletEndpointsSupplier servletEndpointsSupplier() {
|
||||
ServletEndpointsSupplier servletEndpointsSupplier() {
|
||||
return Collections::emptyList;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DispatcherServletPath dispatcherServletPath() {
|
||||
DispatcherServletPath dispatcherServletPath() {
|
||||
return () -> "/test";
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JerseyApplicationPath jerseyApplicationPath() {
|
||||
JerseyApplicationPath jerseyApplicationPath() {
|
||||
return () -> "/jersey";
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class WebEndpointAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Component
|
||||
private static class TestPathMatcher implements PathMapper {
|
||||
static class TestPathMatcher implements PathMapper {
|
||||
|
||||
@Override
|
||||
public String getRootPath(EndpointId endpointId) {
|
||||
|
@ -133,19 +133,19 @@ class WebEndpointAutoConfigurationTests {
|
|||
|
||||
@Component
|
||||
@Endpoint(id = "testone")
|
||||
private static class TestOneEndpoint {
|
||||
static class TestOneEndpoint {
|
||||
|
||||
}
|
||||
|
||||
@Component
|
||||
@Endpoint(id = "testanotherone")
|
||||
private static class TestAnotherOneEndpoint {
|
||||
static class TestAnotherOneEndpoint {
|
||||
|
||||
}
|
||||
|
||||
@Component
|
||||
@Endpoint(id = "testtwo")
|
||||
private static class TestTwoEndpoint {
|
||||
static class TestTwoEndpoint {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentation
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public AuditEventsEndpoint auditEventsEndpoint(AuditEventRepository repository) {
|
||||
AuditEventsEndpoint auditEventsEndpoint(AuditEventRepository repository) {
|
||||
return new AuditEventsEndpoint(repository);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class BeansEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public BeansEndpoint beansEndpoint(ConfigurableApplicationContext context) {
|
||||
BeansEndpoint beansEndpoint(ConfigurableApplicationContext context) {
|
||||
return new BeansEndpoint(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public CachesEndpoint endpoint() {
|
||||
CachesEndpoint endpoint() {
|
||||
Map<String, CacheManager> cacheManagers = new HashMap<>();
|
||||
cacheManagers.put("cacheManager", new ConcurrentMapCacheManager("countries", "cities"));
|
||||
cacheManagers.put("anotherCacheManager", new ConcurrentMapCacheManager("countries"));
|
||||
|
@ -103,7 +103,7 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||
}
|
||||
|
||||
@Bean
|
||||
public CachesEndpointWebExtension endpointWebExtension(CachesEndpoint endpoint) {
|
||||
CachesEndpointWebExtension endpointWebExtension(CachesEndpoint endpoint) {
|
||||
return new CachesEndpointWebExtension(endpoint);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class ConditionsReportEndpointDocumentationTests extends MockMvcEndpointDocument
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public ConditionsReportEndpoint autoConfigurationReportEndpoint(ConfigurableApplicationContext context) {
|
||||
ConditionsReportEndpoint autoConfigurationReportEndpoint(ConfigurableApplicationContext context) {
|
||||
ConditionEvaluationReport conditionEvaluationReport = ConditionEvaluationReport
|
||||
.get(context.getBeanFactory());
|
||||
conditionEvaluationReport
|
||||
|
|
|
@ -59,7 +59,7 @@ class ConfigurationPropertiesReportEndpointDocumentationTests extends MockMvcEnd
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
ConfigurationPropertiesReportEndpoint endpoint() {
|
||||
return new ConfigurationPropertiesReportEndpoint();
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ class EnvironmentEndpointDocumentationTests extends MockMvcEndpointDocumentation
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public EnvironmentEndpoint endpoint(ConfigurableEnvironment environment) {
|
||||
EnvironmentEndpoint endpoint(ConfigurableEnvironment environment) {
|
||||
return new EnvironmentEndpoint(new AbstractEnvironment() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -89,13 +89,13 @@ class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder().generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseConnection.get(getClass().getClassLoader()).getType()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FlywayEndpoint endpoint(ApplicationContext context) {
|
||||
FlywayEndpoint endpoint(ApplicationContext context) {
|
||||
return new FlywayEndpoint(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,23 +92,23 @@ class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public HealthEndpoint endpoint(Map<String, HealthIndicator> healthIndicators) {
|
||||
HealthEndpoint endpoint(Map<String, HealthIndicator> healthIndicators) {
|
||||
return new HealthEndpoint(new CompositeHealthIndicator(new OrderedHealthAggregator(),
|
||||
new HealthIndicatorRegistryFactory().createHealthIndicatorRegistry(healthIndicators)));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DiskSpaceHealthIndicator diskSpaceHealthIndicator() {
|
||||
DiskSpaceHealthIndicator diskSpaceHealthIndicator() {
|
||||
return new DiskSpaceHealthIndicator(new File("."), DataSize.ofMegabytes(10));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSourceHealthIndicator dbHealthIndicator(DataSource dataSource) {
|
||||
DataSourceHealthIndicator dbHealthIndicator(DataSource dataSource) {
|
||||
return new DataSourceHealthIndicator(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CompositeHealthIndicator brokerHealthIndicator() {
|
||||
CompositeHealthIndicator brokerHealthIndicator() {
|
||||
Map<String, HealthIndicator> indicators = new LinkedHashMap<>();
|
||||
indicators.put("us1", () -> Health.up().withDetail("version", "1.0.2").build());
|
||||
indicators.put("us2", () -> Health.up().withDetail("version", "1.0.4").build());
|
||||
|
|
|
@ -61,7 +61,7 @@ class HeapDumpWebEndpointDocumentationTests extends MockMvcEndpointDocumentation
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public HeapDumpWebEndpoint endpoint() {
|
||||
HeapDumpWebEndpoint endpoint() {
|
||||
return new HeapDumpWebEndpoint() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -106,7 +106,7 @@ class HttpTraceEndpointDocumentationTests extends MockMvcEndpointDocumentationTe
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public HttpTraceEndpoint httpTraceEndpoint(HttpTraceRepository repository) {
|
||||
HttpTraceEndpoint httpTraceEndpoint(HttpTraceRepository repository) {
|
||||
return new HttpTraceEndpoint(repository);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,12 +73,12 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public InfoEndpoint endpoint(List<InfoContributor> infoContributors) {
|
||||
InfoEndpoint endpoint(List<InfoContributor> infoContributors) {
|
||||
return new InfoEndpoint(infoContributors);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GitInfoContributor gitInfoContributor() {
|
||||
GitInfoContributor gitInfoContributor() {
|
||||
Properties properties = new Properties();
|
||||
properties.put("branch", "master");
|
||||
properties.put("commit.id", "df027cf1ec5aeba2d4fedd7b8c42b88dc5ce38e5");
|
||||
|
@ -89,7 +89,7 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public BuildInfoContributor buildInfoContributor() {
|
||||
BuildInfoContributor buildInfoContributor() {
|
||||
Properties properties = new Properties();
|
||||
properties.put("group", "com.example");
|
||||
properties.put("artifact", "application");
|
||||
|
|
|
@ -55,12 +55,12 @@ class IntegrationGraphEndpointDocumentationTests extends MockMvcEndpointDocument
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public IntegrationGraphServer integrationGraphServer() {
|
||||
IntegrationGraphServer integrationGraphServer() {
|
||||
return new IntegrationGraphServer();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IntegrationGraphEndpoint endpoint(IntegrationGraphServer integrationGraphServer) {
|
||||
IntegrationGraphEndpoint endpoint(IntegrationGraphServer integrationGraphServer) {
|
||||
return new IntegrationGraphEndpoint(integrationGraphServer);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class LiquibaseEndpointDocumentationTests extends MockMvcEndpointDocumentationTe
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public LiquibaseEndpoint endpoint(ApplicationContext context) {
|
||||
LiquibaseEndpoint endpoint(ApplicationContext context) {
|
||||
return new LiquibaseEndpoint(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class LogFileWebEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public LogFileWebEndpoint endpoint(Environment environment) {
|
||||
LogFileWebEndpoint endpoint(Environment environment) {
|
||||
return new LogFileWebEndpoint(environment);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public LoggersEndpoint endpoint(LoggingSystem loggingSystem) {
|
||||
LoggersEndpoint endpoint(LoggingSystem loggingSystem) {
|
||||
return new LoggersEndpoint(loggingSystem);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,39 +137,39 @@ class MappingsEndpointReactiveDocumentationTests extends AbstractEndpointDocumen
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public NettyReactiveWebServerFactory netty() {
|
||||
NettyReactiveWebServerFactory netty() {
|
||||
return new NettyReactiveWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DispatcherHandlersMappingDescriptionProvider dispatcherHandlersMappingDescriptionProvider() {
|
||||
DispatcherHandlersMappingDescriptionProvider dispatcherHandlersMappingDescriptionProvider() {
|
||||
return new DispatcherHandlersMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MappingsEndpoint mappingsEndpoint(Collection<MappingDescriptionProvider> descriptionProviders,
|
||||
MappingsEndpoint mappingsEndpoint(Collection<MappingDescriptionProvider> descriptionProviders,
|
||||
ConfigurableApplicationContext context) {
|
||||
return new MappingsEndpoint(descriptionProviders, context);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> exampleRouter() {
|
||||
RouterFunction<ServerResponse> exampleRouter() {
|
||||
return route(GET("/foo"), (request) -> ServerResponse.ok().build());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ExampleController exampleController() {
|
||||
ExampleController exampleController() {
|
||||
return new ExampleController();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RestController
|
||||
private static class ExampleController {
|
||||
static class ExampleController {
|
||||
|
||||
@PostMapping(path = "/", consumes = { MediaType.APPLICATION_JSON_VALUE, "!application/xml" },
|
||||
produces = MediaType.TEXT_PLAIN_VALUE, headers = "X-Custom=Foo", params = "a!=alpha")
|
||||
public String example() {
|
||||
String example() {
|
||||
return "Hello World";
|
||||
}
|
||||
|
||||
|
|
|
@ -152,44 +152,44 @@ class MappingsEndpointServletDocumentationTests extends AbstractEndpointDocument
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcat() {
|
||||
TomcatServletWebServerFactory tomcat() {
|
||||
return new TomcatServletWebServerFactory(0);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DispatcherServletsMappingDescriptionProvider dispatcherServletsMappingDescriptionProvider() {
|
||||
DispatcherServletsMappingDescriptionProvider dispatcherServletsMappingDescriptionProvider() {
|
||||
return new DispatcherServletsMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletsMappingDescriptionProvider servletsMappingDescriptionProvider() {
|
||||
ServletsMappingDescriptionProvider servletsMappingDescriptionProvider() {
|
||||
return new ServletsMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FiltersMappingDescriptionProvider filtersMappingDescriptionProvider() {
|
||||
FiltersMappingDescriptionProvider filtersMappingDescriptionProvider() {
|
||||
return new FiltersMappingDescriptionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MappingsEndpoint mappingsEndpoint(Collection<MappingDescriptionProvider> descriptionProviders,
|
||||
MappingsEndpoint mappingsEndpoint(Collection<MappingDescriptionProvider> descriptionProviders,
|
||||
ConfigurableApplicationContext context) {
|
||||
return new MappingsEndpoint(descriptionProviders, context);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ExampleController exampleController() {
|
||||
ExampleController exampleController() {
|
||||
return new ExampleController();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RestController
|
||||
private static class ExampleController {
|
||||
static class ExampleController {
|
||||
|
||||
@PostMapping(path = "/", consumes = { MediaType.APPLICATION_JSON_VALUE, "!application/xml" },
|
||||
produces = MediaType.TEXT_PLAIN_VALUE, headers = "X-Custom=Foo", params = "a!=alpha")
|
||||
public String example() {
|
||||
String example() {
|
||||
return "Hello World";
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class MetricsEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public MetricsEndpoint endpoint() {
|
||||
MetricsEndpoint endpoint() {
|
||||
SimpleMeterRegistry registry = new SimpleMeterRegistry();
|
||||
new JvmMemoryMetrics().bindTo(registry);
|
||||
return new MetricsEndpoint(registry);
|
||||
|
|
|
@ -48,7 +48,7 @@ class PrometheusScrapeEndpointDocumentationTests extends MockMvcEndpointDocument
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public PrometheusScrapeEndpoint endpoint() {
|
||||
PrometheusScrapeEndpoint endpoint() {
|
||||
CollectorRegistry collectorRegistry = new CollectorRegistry(true);
|
||||
PrometheusMeterRegistry meterRegistry = new PrometheusMeterRegistry((key) -> null, collectorRegistry,
|
||||
Clock.SYSTEM);
|
||||
|
|
|
@ -90,27 +90,27 @@ class ScheduledTasksEndpointDocumentationTests extends MockMvcEndpointDocumentat
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public ScheduledTasksEndpoint endpoint(Collection<ScheduledTaskHolder> holders) {
|
||||
ScheduledTasksEndpoint endpoint(Collection<ScheduledTaskHolder> holders) {
|
||||
return new ScheduledTasksEndpoint(holders);
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 0/3 1/1 * ?")
|
||||
public void processOrders() {
|
||||
void processOrders() {
|
||||
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 5000, initialDelay = 5000)
|
||||
public void purge() {
|
||||
void purge() {
|
||||
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 3000, initialDelay = 10000)
|
||||
public void retrieveIssues() {
|
||||
void retrieveIssues() {
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SchedulingConfigurer schedulingConfigurer() {
|
||||
SchedulingConfigurer schedulingConfigurer() {
|
||||
return (registrar) -> registrar.addTriggerTask(new CustomTriggeredRunnable(), new CustomTrigger());
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class SessionsEndpointDocumentationTests extends MockMvcEndpointDocumentationTes
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public SessionsEndpoint endpoint(FindByIndexNameSessionRepository<?> sessionRepository) {
|
||||
SessionsEndpoint endpoint(FindByIndexNameSessionRepository<?> sessionRepository) {
|
||||
return new SessionsEndpoint(sessionRepository);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class ShutdownEndpointDocumentationTests extends MockMvcEndpointDocumentationTes
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public ShutdownEndpoint endpoint(Environment environment) {
|
||||
ShutdownEndpoint endpoint(Environment environment) {
|
||||
ShutdownEndpoint endpoint = new ShutdownEndpoint();
|
||||
endpoint.setApplicationContext(new AnnotationConfigApplicationContext());
|
||||
return endpoint;
|
||||
|
|
|
@ -165,7 +165,7 @@ class ThreadDumpEndpointDocumentationTests extends MockMvcEndpointDocumentationT
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public ThreadDumpEndpoint endpoint() {
|
||||
ThreadDumpEndpoint endpoint() {
|
||||
return new ThreadDumpEndpoint();
|
||||
}
|
||||
|
||||
|
|
|
@ -332,12 +332,12 @@ class HealthEndpointWebExtensionTests {
|
|||
static class HealthIndicatorsConfiguration {
|
||||
|
||||
@Bean
|
||||
public HealthIndicator simpleHealthIndicator() {
|
||||
HealthIndicator simpleHealthIndicator() {
|
||||
return () -> Health.up().withDetail("counter", 42).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HealthIndicator compositeHealthIndicator(HealthIndicator healthIndicator) {
|
||||
HealthIndicator compositeHealthIndicator(HealthIndicator healthIndicator) {
|
||||
Map<String, HealthIndicator> nestedIndicators = new HashMap<>();
|
||||
nestedIndicators.put("one", healthIndicator);
|
||||
nestedIndicators.put("two", () -> Health.up().build());
|
||||
|
|
|
@ -105,7 +105,7 @@ class HealthIndicatorAutoConfigurationTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnEnabledHealthIndicator("custom")
|
||||
public HealthIndicator customHealthIndicator() {
|
||||
HealthIndicator customHealthIndicator() {
|
||||
return new CustomHealthIndicator();
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ class HealthIndicatorAutoConfigurationTests {
|
|||
static class CustomHealthAggregatorConfiguration {
|
||||
|
||||
@Bean
|
||||
public HealthAggregator healthAggregator() {
|
||||
HealthAggregator healthAggregator() {
|
||||
return (healths) -> Health.down().build();
|
||||
}
|
||||
|
||||
|
|
|
@ -207,12 +207,12 @@ class ReactiveHealthEndpointWebExtensionTests {
|
|||
static class HealthIndicatorsConfiguration {
|
||||
|
||||
@Bean
|
||||
public HealthIndicator firstHealthIndicator() {
|
||||
HealthIndicator firstHealthIndicator() {
|
||||
return () -> Health.up().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ReactiveHealthIndicator secondHealthIndicator() {
|
||||
ReactiveHealthIndicator secondHealthIndicator() {
|
||||
return () -> Mono.just(Health.up().build());
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ class InfoContributorAutoConfigurationTests {
|
|||
static class GitPropertiesConfiguration {
|
||||
|
||||
@Bean
|
||||
public GitProperties gitProperties() {
|
||||
GitProperties gitProperties() {
|
||||
Properties properties = new Properties();
|
||||
properties.put("branch", "master");
|
||||
properties.put("commit.id", "abcdefg");
|
||||
|
@ -168,7 +168,7 @@ class InfoContributorAutoConfigurationTests {
|
|||
static class BuildPropertiesConfiguration {
|
||||
|
||||
@Bean
|
||||
public BuildProperties buildProperties() {
|
||||
BuildProperties buildProperties() {
|
||||
Properties properties = new Properties();
|
||||
properties.put("group", "com.example");
|
||||
properties.put("artifact", "demo");
|
||||
|
@ -182,7 +182,7 @@ class InfoContributorAutoConfigurationTests {
|
|||
static class CustomInfoContributorConfiguration {
|
||||
|
||||
@Bean
|
||||
public InfoContributor customInfoContributor() {
|
||||
InfoContributor customInfoContributor() {
|
||||
return (builder) -> {
|
||||
};
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class InfoContributorAutoConfigurationTests {
|
|||
static class CustomGitInfoContributorConfiguration {
|
||||
|
||||
@Bean
|
||||
public GitInfoContributor customGitInfoContributor() {
|
||||
GitInfoContributor customGitInfoContributor() {
|
||||
return new GitInfoContributor(new GitProperties(new Properties()));
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ class InfoContributorAutoConfigurationTests {
|
|||
static class CustomBuildInfoContributorConfiguration {
|
||||
|
||||
@Bean
|
||||
public BuildInfoContributor customBuildInfoContributor() {
|
||||
BuildInfoContributor customBuildInfoContributor() {
|
||||
return new BuildInfoContributor(new BuildProperties(new Properties()));
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class ControllerEndpointWebFluxIntegrationTests {
|
|||
static class ExampleController {
|
||||
|
||||
@GetMapping("/")
|
||||
public String example() {
|
||||
String example() {
|
||||
return "Example";
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class ControllerEndpointWebMvcIntegrationTests {
|
|||
static class ExampleController {
|
||||
|
||||
@GetMapping("/")
|
||||
public String example() {
|
||||
String example() {
|
||||
return "Example";
|
||||
}
|
||||
|
||||
|
|
|
@ -131,20 +131,20 @@ class JmxEndpointIntegrationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class HttpTraceRepositoryConfiguration {
|
||||
static class HttpTraceRepositoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public InMemoryHttpTraceRepository httpTraceRepository() {
|
||||
InMemoryHttpTraceRepository httpTraceRepository() {
|
||||
return new InMemoryHttpTraceRepository();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class AuditEventRepositoryConfiguration {
|
||||
static class AuditEventRepositoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public InMemoryAuditEventRepository auditEventRepository() {
|
||||
InMemoryAuditEventRepository auditEventRepository() {
|
||||
return new InMemoryAuditEventRepository();
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class JolokiaEndpointAutoConfigurationIntegrationTests {
|
|||
JolokiaEndpointAutoConfiguration.class, EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
|
||||
ServletManagementContextAutoConfiguration.class, ManagementContextAutoConfiguration.class,
|
||||
ServletEndpointManagementContextConfiguration.class })
|
||||
protected static class Application {
|
||||
static class Application {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class WebEndpointsAutoConfigurationIntegrationTests {
|
|||
RedisRepositoriesAutoConfiguration.class, MetricsAutoConfiguration.class })
|
||||
@SpringBootConfiguration
|
||||
@SuppressWarnings("deprecation")
|
||||
public static class WebEndpointTestApplication {
|
||||
static class WebEndpointTestApplication {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ class WebMvcEndpointCorsIntegrationTests {
|
|||
}
|
||||
|
||||
@FunctionalInterface
|
||||
private interface MockMvcConsumer {
|
||||
interface MockMvcConsumer {
|
||||
|
||||
void accept(MockMvc mockMvc) throws Exception;
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ class WebMvcEndpointExposureIntegrationTests {
|
|||
static class CustomMvcEndpoint {
|
||||
|
||||
@GetMapping("/")
|
||||
public String main() {
|
||||
String main() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
|
@ -208,20 +208,20 @@ class WebMvcEndpointExposureIntegrationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class HttpTraceRepositoryConfiguration {
|
||||
static class HttpTraceRepositoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public InMemoryHttpTraceRepository httpTraceRepository() {
|
||||
InMemoryHttpTraceRepository httpTraceRepository() {
|
||||
return new InMemoryHttpTraceRepository();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class AuditEventRepositoryConfiguration {
|
||||
static class AuditEventRepositoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public InMemoryAuditEventRepository auditEventRepository() {
|
||||
InMemoryAuditEventRepository auditEventRepository() {
|
||||
return new InMemoryAuditEventRepository();
|
||||
}
|
||||
|
||||
|
|
|
@ -100,11 +100,11 @@ class DataSourceHealthIndicatorAutoConfigurationTests {
|
|||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties
|
||||
protected static class DataSourceConfig {
|
||||
static class DataSourceConfig {
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "spring.datasource.test")
|
||||
public DataSource testDataSource() {
|
||||
DataSource testDataSource() {
|
||||
return DataSourceBuilder.create().type(org.apache.tomcat.jdbc.pool.DataSource.class)
|
||||
.driverClassName("org.hsqldb.jdbc.JDBCDriver").url("jdbc:hsqldb:mem:test").username("sa").build();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class DataSourceHealthIndicatorAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
protected static class RoutingDatasourceConfig {
|
||||
static class RoutingDatasourceConfig {
|
||||
|
||||
@Bean
|
||||
AbstractRoutingDataSource routingDataSource() {
|
||||
|
|
|
@ -102,7 +102,7 @@ class JolokiaEndpointAutoConfigurationTests {
|
|||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext) {
|
||||
ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext) {
|
||||
return new ServletEndpointDiscoverer(applicationContext, null, Collections.emptyList());
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class LiquibaseEndpointAutoConfigurationTests {
|
|||
static class DataSourceClosingLiquibaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public SpringLiquibase liquibase() {
|
||||
SpringLiquibase liquibase() {
|
||||
return new DataSourceClosingSpringLiquibase() {
|
||||
|
||||
private boolean propertiesSet = false;
|
||||
|
|
|
@ -66,7 +66,7 @@ class LoggersEndpointAutoConfigurationTests {
|
|||
static class LoggingConfiguration {
|
||||
|
||||
@Bean
|
||||
public LoggingSystem loggingSystem() {
|
||||
LoggingSystem loggingSystem() {
|
||||
return mock(LoggingSystem.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ class CompositeMeterRegistryAutoConfigurationTests {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public Clock micrometerClock() {
|
||||
Clock micrometerClock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class CompositeMeterRegistryAutoConfigurationTests {
|
|||
static class SingleMeterRegistryConfig {
|
||||
|
||||
@Bean
|
||||
public MeterRegistry meterRegistry() {
|
||||
MeterRegistry meterRegistry() {
|
||||
return new TestMeterRegistry();
|
||||
}
|
||||
|
||||
|
@ -115,12 +115,12 @@ class CompositeMeterRegistryAutoConfigurationTests {
|
|||
static class MultipleMeterRegistriesConfig {
|
||||
|
||||
@Bean
|
||||
public MeterRegistry meterRegistryOne() {
|
||||
MeterRegistry meterRegistryOne() {
|
||||
return new TestMeterRegistry();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MeterRegistry meterRegistryTwo() {
|
||||
MeterRegistry meterRegistryTwo() {
|
||||
return new SimpleMeterRegistry();
|
||||
}
|
||||
|
||||
|
@ -131,12 +131,12 @@ class CompositeMeterRegistryAutoConfigurationTests {
|
|||
|
||||
@Bean
|
||||
@Primary
|
||||
public MeterRegistry meterRegistryOne() {
|
||||
MeterRegistry meterRegistryOne() {
|
||||
return new TestMeterRegistry();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MeterRegistry meterRegistryTwo() {
|
||||
MeterRegistry meterRegistryTwo() {
|
||||
return new SimpleMeterRegistry();
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class JvmMetricsAutoConfigurationTests {
|
|||
static class CustomJvmGcMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public JvmGcMetrics customJvmGcMetrics() {
|
||||
JvmGcMetrics customJvmGcMetrics() {
|
||||
return new JvmGcMetrics();
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class JvmMetricsAutoConfigurationTests {
|
|||
static class CustomJvmMemoryMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public JvmMemoryMetrics customJvmMemoryMetrics() {
|
||||
JvmMemoryMetrics customJvmMemoryMetrics() {
|
||||
return new JvmMemoryMetrics();
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class JvmMetricsAutoConfigurationTests {
|
|||
static class CustomJvmThreadMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public JvmThreadMetrics customJvmThreadMetrics() {
|
||||
JvmThreadMetrics customJvmThreadMetrics() {
|
||||
return new JvmThreadMetrics();
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ class JvmMetricsAutoConfigurationTests {
|
|||
static class CustomClassLoaderMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public ClassLoaderMetrics customClassLoaderMetrics() {
|
||||
ClassLoaderMetrics customClassLoaderMetrics() {
|
||||
return new ClassLoaderMetrics();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class KafkaMetricsAutoConfigurationTests {
|
|||
static class CustomKafkaConsumerMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public KafkaConsumerMetrics customKafkaConsumerMetrics() {
|
||||
KafkaConsumerMetrics customKafkaConsumerMetrics() {
|
||||
return new KafkaConsumerMetrics();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests {
|
|||
static class CustomLog4J2MetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public Log4j2Metrics customLog4J2Metrics() {
|
||||
Log4j2Metrics customLog4J2Metrics() {
|
||||
return new Log4j2Metrics();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class LogbackMetricsAutoConfigurationTests {
|
|||
static class CustomLogbackMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public LogbackMetrics customLogbackMetrics() {
|
||||
LogbackMetrics customLogbackMetrics() {
|
||||
return new LogbackMetrics();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,17 +74,17 @@ class MeterRegistryCustomizerTests {
|
|||
static class MeterRegistryCustomizerConfiguration {
|
||||
|
||||
@Bean
|
||||
public MeterRegistryCustomizer<MeterRegistry> commonTags() {
|
||||
MeterRegistryCustomizer<MeterRegistry> commonTags() {
|
||||
return (registry) -> registry.config().commonTags("region", "us-east-1");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MeterRegistryCustomizer<PrometheusMeterRegistry> prometheusOnlyCommonTags() {
|
||||
MeterRegistryCustomizer<PrometheusMeterRegistry> prometheusOnlyCommonTags() {
|
||||
return (registry) -> registry.config().commonTags("job", "myjob");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MyThing myThing(MeterRegistry registry) {
|
||||
MyThing myThing(MeterRegistry registry) {
|
||||
registry.gauge("my.thing", 0);
|
||||
return new MyThing();
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ class MetricsAutoConfigurationIntegrationTests {
|
|||
|
||||
@Primary
|
||||
@Bean
|
||||
public MeterRegistry simpleMeterRegistry() {
|
||||
MeterRegistry simpleMeterRegistry() {
|
||||
return new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock());
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class MissingRequiredConfigurationFailureAnalyzerTests {
|
|||
static class MissingAccountIdConfiguration {
|
||||
|
||||
@Bean
|
||||
public NewRelicMeterRegistry meterRegistry() {
|
||||
NewRelicMeterRegistry meterRegistry() {
|
||||
return new NewRelicMeterRegistry((key) -> null, Clock.SYSTEM);
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ class PropertiesMeterFilterTests {
|
|||
return binder.bind("", Bindable.of(MetricsProperties.class)).orElseGet(MetricsProperties::new);
|
||||
}
|
||||
|
||||
private static class TestMeterRegistry extends SimpleMeterRegistry {
|
||||
static class TestMeterRegistry extends SimpleMeterRegistry {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class SystemMetricsAutoConfigurationTests {
|
|||
static class CustomUptimeMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public UptimeMetrics customUptimeMetrics() {
|
||||
UptimeMetrics customUptimeMetrics() {
|
||||
return new UptimeMetrics();
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class SystemMetricsAutoConfigurationTests {
|
|||
static class CustomProcessorMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public ProcessorMetrics customProcessorMetrics() {
|
||||
ProcessorMetrics customProcessorMetrics() {
|
||||
return new ProcessorMetrics();
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class SystemMetricsAutoConfigurationTests {
|
|||
static class CustomFileDescriptorMetricsConfiguration {
|
||||
|
||||
@Bean
|
||||
public FileDescriptorMetrics customFileDescriptorMetrics() {
|
||||
FileDescriptorMetrics customFileDescriptorMetrics() {
|
||||
return new FileDescriptorMetrics();
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public AppOpticsConfig customConfig() {
|
||||
AppOpticsConfig customConfig() {
|
||||
return (key) -> "appoptics.apiToken".equals(key) ? "abcde" : null;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ class AppOpticsMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public AppOpticsMeterRegistry customRegistry(AppOpticsConfig config, Clock clock) {
|
||||
AppOpticsMeterRegistry customRegistry(AppOpticsConfig config, Clock clock) {
|
||||
return new AppOpticsMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class AtlasMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ class AtlasMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public AtlasConfig customConfig() {
|
||||
AtlasConfig customConfig() {
|
||||
return (key) -> null;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class AtlasMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public AtlasMeterRegistry customRegistry(AtlasConfig config, Clock clock) {
|
||||
AtlasMeterRegistry customRegistry(AtlasConfig config, Clock clock) {
|
||||
return new AtlasMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public DatadogConfig customConfig() {
|
||||
DatadogConfig customConfig() {
|
||||
return (key) -> {
|
||||
if ("datadog.apiKey".equals(key)) {
|
||||
return "12345";
|
||||
|
@ -122,7 +122,7 @@ class DatadogMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public DatadogMeterRegistry customRegistry(DatadogConfig config, Clock clock) {
|
||||
DatadogMeterRegistry customRegistry(DatadogConfig config, Clock clock) {
|
||||
return new DatadogMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public DynatraceConfig customConfig() {
|
||||
DynatraceConfig customConfig() {
|
||||
return (key) -> {
|
||||
if ("dynatrace.uri".equals(key)) {
|
||||
return "https://dynatrace.example.com";
|
||||
|
@ -136,7 +136,7 @@ class DynatraceMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public DynatraceMeterRegistry customRegistry(DynatraceConfig config, Clock clock) {
|
||||
DynatraceMeterRegistry customRegistry(DynatraceConfig config, Clock clock) {
|
||||
return new DynatraceMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class ElasticMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class ElasticMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public ElasticConfig customConfig() {
|
||||
ElasticConfig customConfig() {
|
||||
return (key) -> null;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ class ElasticMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public ElasticMeterRegistry customRegistry(ElasticConfig config, Clock clock) {
|
||||
ElasticMeterRegistry customRegistry(ElasticConfig config, Clock clock) {
|
||||
return new ElasticMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class GangliaMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class GangliaMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public GangliaConfig customConfig() {
|
||||
GangliaConfig customConfig() {
|
||||
return (key) -> null;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ class GangliaMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public GangliaMeterRegistry customRegistry(GangliaConfig config, Clock clock) {
|
||||
GangliaMeterRegistry customRegistry(GangliaConfig config, Clock clock) {
|
||||
return new GangliaMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public GraphiteConfig customConfig() {
|
||||
GraphiteConfig customConfig() {
|
||||
return (key) -> {
|
||||
if ("Graphite.apiKey".equals(key)) {
|
||||
return "12345";
|
||||
|
@ -126,7 +126,7 @@ class GraphiteMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public GraphiteMeterRegistry customRegistry(GraphiteConfig config, Clock clock) {
|
||||
GraphiteMeterRegistry customRegistry(GraphiteConfig config, Clock clock) {
|
||||
return new GraphiteMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class HumioMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class HumioMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public HumioConfig customConfig() {
|
||||
HumioConfig customConfig() {
|
||||
return (key) -> null;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ class HumioMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public HumioMeterRegistry customRegistry(HumioConfig config, Clock clock) {
|
||||
HumioMeterRegistry customRegistry(HumioConfig config, Clock clock) {
|
||||
return new HumioMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class InfluxMetricsExportAutoConfigurationTests {
|
|||
static class BaseConfiguration {
|
||||
|
||||
@Bean
|
||||
public Clock clock() {
|
||||
Clock clock() {
|
||||
return Clock.SYSTEM;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ class InfluxMetricsExportAutoConfigurationTests {
|
|||
static class CustomConfigConfiguration {
|
||||
|
||||
@Bean
|
||||
public InfluxConfig customConfig() {
|
||||
InfluxConfig customConfig() {
|
||||
return (key) -> null;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class InfluxMetricsExportAutoConfigurationTests {
|
|||
static class CustomRegistryConfiguration {
|
||||
|
||||
@Bean
|
||||
public InfluxMeterRegistry customRegistry(InfluxConfig config, Clock clock) {
|
||||
InfluxMeterRegistry customRegistry(InfluxConfig config, Clock clock) {
|
||||
return new InfluxMeterRegistry(config, clock);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue