Reformat code using Eclipse Mars

This commit is contained in:
Phillip Webb 2015-10-07 23:37:10 -07:00
parent e473364e4e
commit c9fb9916b8
408 changed files with 2831 additions and 2652 deletions

View File

@ -113,19 +113,19 @@ public class EndpointDocumentation {
final List<EndpointDoc> endpoints = new ArrayList<EndpointDoc>();
model.put("endpoints", endpoints);
for (MvcEndpoint endpoint : getEndpoints()) {
final String endpointPath = StringUtils.hasText(endpoint.getPath()) ? endpoint
.getPath() : "/";
final String endpointPath = StringUtils.hasText(endpoint.getPath())
? endpoint.getPath() : "/";
if (!endpointPath.equals("/docs") && !endpointPath.equals("/logfile")) {
String output = endpointPath.substring(1);
output = output.length() > 0 ? output : "./";
this.mockMvc
.perform(get(endpointPath).accept(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get(endpointPath).accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(document(output))
.andDo(new ResultHandler() {
@Override
public void handle(MvcResult mvcResult) throws Exception {
EndpointDoc endpoint = new EndpointDoc(docs, endpointPath);
EndpointDoc endpoint = new EndpointDoc(docs,
endpointPath);
endpoints.add(endpoint);
}
});
@ -135,8 +135,8 @@ public class EndpointDocumentation {
file.getParentFile().mkdirs();
PrintWriter writer = new PrintWriter(file, "UTF-8");
try {
Template template = this.templates.createTemplate(new File(
"src/restdoc/resources/templates/endpoints.adoc.tpl"));
Template template = this.templates.createTemplate(
new File("src/restdoc/resources/templates/endpoints.adoc.tpl"));
template.make(model).writeTo(writer);
}
finally {

View File

@ -103,11 +103,11 @@ import org.springframework.util.StringUtils;
* infrastructure add beans of type {@link CrshShellProperties} to the application
* context.
* <p>
* Additional shell commands can be implemented using the guide and documentation at <a
* href="http://www.crashub.org">crashub.org</a>. By default Boot will search for commands
* using the following classpath scanning pattern {@code classpath*:/commands/**}. To add
* different locations or override the default use {@code shell.command_path_patterns} in
* your application configuration.
* Additional shell commands can be implemented using the guide and documentation at
* <a href="http://www.crashub.org">crashub.org</a>. By default Boot will search for
* commands using the following classpath scanning pattern {@code classpath*:/commands/**}
* . To add different locations or override the default use
* {@code shell.command_path_patterns} in your application configuration.
*
* @author Christian Dupuis
* @see ShellProperties
@ -179,8 +179,8 @@ public class CrshAutoConfiguration {
// ConfigurationProperties.
SpringAuthenticationProperties authenticationProperties = new SpringAuthenticationProperties();
if (this.management != null) {
authenticationProperties.setRoles(new String[] { this.management
.getSecurity().getRole() });
authenticationProperties.setRoles(
new String[] { this.management.getSecurity().getRole() });
}
return authenticationProperties;
}
@ -239,8 +239,8 @@ public class CrshAutoConfiguration {
pathPattern, this.resourceLoader, filterPatterns)));
}
catch (IOException ex) {
throw new IllegalStateException("Failed to mount file system for '"
+ pathPattern + "'", ex);
throw new IllegalStateException(
"Failed to mount file system for '" + pathPattern + "'", ex);
}
}
return fileSystem;
@ -272,9 +272,9 @@ public class CrshAutoConfiguration {
private static class AuthenticationManagerAdapter extends
CRaSHPlugin<AuthenticationPlugin> implements AuthenticationPlugin<String> {
private static final PropertyDescriptor<String> ROLES = PropertyDescriptor
.create("auth.spring.roles", "ADMIN",
"Comma separated list of roles required to access the shell");
private static final PropertyDescriptor<String> ROLES = PropertyDescriptor.create(
"auth.spring.roles", "ADMIN",
"Comma separated list of roles required to access the shell");
@Autowired
private AuthenticationManager authenticationManager;
@ -346,8 +346,8 @@ public class CrshAutoConfiguration {
* {@link ServiceLoaderDiscovery} to expose {@link CRaSHPlugin} Beans from Spring and
* deal with filtering disabled plugins.
*/
private static class BeanFactoryFilteringPluginDiscovery extends
ServiceLoaderDiscovery {
private static class BeanFactoryFilteringPluginDiscovery
extends ServiceLoaderDiscovery {
private final ListableBeanFactory beanFactory;
@ -355,7 +355,7 @@ public class CrshAutoConfiguration {
BeanFactoryFilteringPluginDiscovery(ClassLoader classLoader,
ListableBeanFactory beanFactory, String[] disabledPlugins)
throws NullPointerException {
throws NullPointerException {
super(classLoader);
this.beanFactory = beanFactory;
this.disabledPlugins = disabledPlugins;
@ -372,8 +372,8 @@ public class CrshAutoConfiguration {
}
}
Collection<CRaSHPlugin> pluginBeans = this.beanFactory.getBeansOfType(
CRaSHPlugin.class).values();
Collection<CRaSHPlugin> pluginBeans = this.beanFactory
.getBeansOfType(CRaSHPlugin.class).values();
for (CRaSHPlugin<?> pluginBean : pluginBeans) {
if (isEnabled(pluginBean)) {
plugins.add(pluginBean);
@ -404,8 +404,8 @@ public class CrshAutoConfiguration {
private boolean isEnabled(Class<?> pluginClass) {
for (String disabledPlugin : this.disabledPlugins) {
if (ClassUtils.getShortName(pluginClass).equalsIgnoreCase(disabledPlugin)
|| ClassUtils.getQualifiedName(pluginClass).equalsIgnoreCase(
disabledPlugin)) {
|| ClassUtils.getQualifiedName(pluginClass)
.equalsIgnoreCase(disabledPlugin)) {
return false;
}
}
@ -506,7 +506,8 @@ public class CrshAutoConfiguration {
Resource[] resources = this.resourceLoader.getResources(getName());
List<ResourceHandle> files = new ArrayList<ResourceHandle>();
for (Resource resource : resources) {
if (!resource.getURL().getPath().endsWith("/") && !shouldFilter(resource)) {
if (!resource.getURL().getPath().endsWith("/")
&& !shouldFilter(resource)) {
files.add(new FileHandle(resource.getFilename(), resource));
}
}

View File

@ -60,7 +60,8 @@ public class EndpointMBeanExportAutoConfiguration {
@Bean
public EndpointMBeanExporter endpointMBeanExporter(MBeanServer server) {
EndpointMBeanExporter mbeanExporter = new EndpointMBeanExporter(this.objectMapper);
EndpointMBeanExporter mbeanExporter = new EndpointMBeanExporter(
this.objectMapper);
String domain = this.properties.getDomain();
if (StringUtils.hasText(domain)) {
mbeanExporter.setDomain(domain);

View File

@ -95,8 +95,8 @@ import org.springframework.web.servlet.DispatcherServlet;
ManagementServerPropertiesAutoConfiguration.class,
RepositoryRestMvcAutoConfiguration.class, HypermediaAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class })
public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
BeanFactoryAware, SmartInitializingSingleton {
public class EndpointWebMvcAutoConfiguration
implements ApplicationContextAware, BeanFactoryAware, SmartInitializingSingleton {
private static final Log logger = LogFactory
.getLog(EndpointWebMvcAutoConfiguration.class);
@ -138,8 +138,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
public void afterSingletonsInstantiated() {
ManagementServerPort managementPort = ManagementServerPort.DIFFERENT;
if (this.applicationContext instanceof WebApplicationContext) {
managementPort = ManagementServerPort.get(
this.applicationContext.getEnvironment(), this.beanFactory);
managementPort = ManagementServerPort
.get(this.applicationContext.getEnvironment(), this.beanFactory);
}
if (managementPort == ManagementServerPort.DIFFERENT
&& this.applicationContext instanceof EmbeddedWebApplicationContext
@ -147,10 +147,10 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
.getEmbeddedServletContainer() != null) {
createChildManagementContext();
}
if (managementPort == ManagementServerPort.SAME
&& this.applicationContext.getEnvironment() instanceof ConfigurableEnvironment) {
addLocalManagementPortPropertyAlias((ConfigurableEnvironment) this.applicationContext
.getEnvironment());
if (managementPort == ManagementServerPort.SAME && this.applicationContext
.getEnvironment() instanceof ConfigurableEnvironment) {
addLocalManagementPortPropertyAlias(
(ConfigurableEnvironment) this.applicationContext.getEnvironment());
}
}
@ -163,8 +163,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
PropertyPlaceholderAutoConfiguration.class,
EmbeddedServletContainerAutoConfiguration.class,
DispatcherServletAutoConfiguration.class);
CloseEventPropagationListener
.addIfPossible(this.applicationContext, childContext);
CloseEventPropagationListener.addIfPossible(this.applicationContext,
childContext);
try {
childContext.refresh();
managementContextResolver().setApplicationContext(childContext);
@ -174,8 +174,9 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
// and this is the signature of that happening
if (ex instanceof EmbeddedServletContainerException
|| ex.getCause() instanceof EmbeddedServletContainerException) {
logger.warn("Could not start embedded management container (management endpoints "
+ "are still available through JMX)");
logger.warn(
"Could not start embedded management container (management endpoints "
+ "are still available through JMX)");
logger.debug("Embedded management container startup failed", ex);
}
else {
@ -191,8 +192,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
*/
private void addLocalManagementPortPropertyAlias(
final ConfigurableEnvironment environment) {
environment.getPropertySources().addLast(
new PropertySource<Object>("Management Server") {
environment.getPropertySources()
.addLast(new PropertySource<Object>("Management Server") {
@Override
public Object getProperty(String name) {
if ("local.management.port".equals(name)) {
@ -239,7 +240,7 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
throws ServletException, IOException {
if (this.properties == null) {
this.properties = this.applicationContext
.getBean(ManagementServerProperties.class);
@ -257,8 +258,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
* {@link ApplicationListener} to propagate the {@link ContextClosedEvent} from a
* parent to a child.
*/
private static class CloseEventPropagationListener implements
ApplicationListener<ContextClosedEvent> {
private static class CloseEventPropagationListener
implements ApplicationListener<ContextClosedEvent> {
private final ApplicationContext parentContext;
@ -286,14 +287,14 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
private static void add(ConfigurableApplicationContext parentContext,
ConfigurableApplicationContext childContext) {
parentContext.addApplicationListener(new CloseEventPropagationListener(
parentContext, childContext));
parentContext.addApplicationListener(
new CloseEventPropagationListener(parentContext, childContext));
}
}
private static class OnManagementMvcCondition extends SpringBootCondition implements
ConfigurationCondition {
private static class OnManagementMvcCondition extends SpringBootCondition
implements ConfigurationCondition {
@Override
public ConfigurationPhase getConfigurationPhase() {
@ -306,8 +307,8 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
if (!(context.getResourceLoader() instanceof WebApplicationContext)) {
return ConditionOutcome.noMatch("Non WebApplicationContext");
}
ManagementServerPort port = ManagementServerPort.get(
context.getEnvironment(), context.getBeanFactory());
ManagementServerPort port = ManagementServerPort.get(context.getEnvironment(),
context.getBeanFactory());
return new ConditionOutcome(port == ManagementServerPort.SAME,
"Management context");
}
@ -321,17 +322,15 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
public static ManagementServerPort get(Environment environment,
BeanFactory beanFactory) {
Integer serverPort = getPortProperty(environment, "server.");
if (serverPort == null
&& hasCustomBeanDefinition(beanFactory, ServerProperties.class,
ServerPropertiesAutoConfiguration.class)) {
if (serverPort == null && hasCustomBeanDefinition(beanFactory,
ServerProperties.class, ServerPropertiesAutoConfiguration.class)) {
ServerProperties bean = beanFactory.getBean(ServerProperties.class);
serverPort = bean.getPort();
}
Integer managementPort = getPortProperty(environment, "management.");
if (managementPort == null
&& hasCustomBeanDefinition(beanFactory,
ManagementServerProperties.class,
ManagementServerPropertiesAutoConfiguration.class)) {
if (managementPort == null && hasCustomBeanDefinition(beanFactory,
ManagementServerProperties.class,
ManagementServerPropertiesAutoConfiguration.class)) {
ManagementServerProperties bean = beanFactory
.getBean(ManagementServerProperties.class);
managementPort = bean.getPort();
@ -342,7 +341,7 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
return ((managementPort == null)
|| (serverPort == null && managementPort.equals(8080))
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
: DIFFERENT);
: DIFFERENT);
}
private static Integer getPortProperty(Environment environment, String prefix) {

View File

@ -159,8 +159,8 @@ public class EndpointWebMvcChildContextConfiguration {
*/
@Configuration
@ConditionalOnClass(WebSecurityConfigurerAdapter.class)
protected static class SecureEndpointHandlerMappingConfiguration extends
EndpointHandlerMappingConfiguration {
protected static class SecureEndpointHandlerMappingConfiguration
extends EndpointHandlerMappingConfiguration {
@Override
protected void postProcessMapping(ListableBeanFactory beanFactory,
@ -203,8 +203,8 @@ public class EndpointWebMvcChildContextConfiguration {
}
static class ServerCustomization implements EmbeddedServletContainerCustomizer,
Ordered {
static class ServerCustomization
implements EmbeddedServletContainerCustomizer, Ordered {
@Autowired
private ListableBeanFactory beanFactory;

View File

@ -146,7 +146,8 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
* Controller advice that adds links to the actuator endpoint's path.
*/
@ControllerAdvice
public static class ActuatorEndpointLinksAdvice implements ResponseBodyAdvice<Object> {
public static class ActuatorEndpointLinksAdvice
implements ResponseBodyAdvice<Object> {
@Autowired
private MvcEndpoints endpoints;
@ -187,8 +188,8 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
}
private void beforeBodyWrite(Object body, ServletServerHttpRequest request) {
Object pattern = request.getServletRequest().getAttribute(
HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
Object pattern = request.getServletRequest()
.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
if (pattern != null && body instanceof ResourceSupport) {
beforeBodyWrite(pattern.toString(), (ResourceSupport) body);
}
@ -196,15 +197,14 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
private void beforeBodyWrite(String path, ResourceSupport body) {
if (isActuatorEndpointPath(path)) {
this.linksEnhancer
.addEndpointLinks(body, this.actuatorEndpoint.getPath());
this.linksEnhancer.addEndpointLinks(body,
this.actuatorEndpoint.getPath());
}
}
private boolean isActuatorEndpointPath(String path) {
return this.actuatorEndpoint != null
&& (this.management.getContextPath() + this.actuatorEndpoint
.getPath()).equals(path);
return this.actuatorEndpoint != null && (this.management.getContextPath()
+ this.actuatorEndpoint.getPath()).equals(path);
}
}
@ -293,13 +293,14 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
private boolean isHypermediaDisabled(MethodParameter returnType) {
return AnnotationUtils.findAnnotation(returnType.getMethod(),
HypermediaDisabled.class) != null
|| AnnotationUtils.findAnnotation(returnType.getMethod()
.getDeclaringClass(), HypermediaDisabled.class) != null;
|| AnnotationUtils.findAnnotation(
returnType.getMethod().getDeclaringClass(),
HypermediaDisabled.class) != null;
}
private String getPath(ServletServerHttpRequest request) {
String path = (String) request.getServletRequest().getAttribute(
HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
String path = (String) request.getServletRequest()
.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
return (path == null ? "" : path);
}

View File

@ -139,8 +139,8 @@ public class EndpointWebMvcManagementContextConfiguration {
boolean secure = (security != null && security.isEnabled());
HealthMvcEndpoint healthMvcEndpoint = new HealthMvcEndpoint(delegate, secure);
if (this.healthMvcEndpointProperties.getMapping() != null) {
healthMvcEndpoint.addStatusMapping(this.healthMvcEndpointProperties
.getMapping());
healthMvcEndpoint
.addStatusMapping(this.healthMvcEndpointProperties.getMapping());
}
return healthMvcEndpoint;
}

View File

@ -134,8 +134,8 @@ public class HealthIndicatorAutoConfiguration {
@SuppressWarnings("unchecked")
protected H createHealthIndicator(S source) {
Class<?>[] generics = ResolvableType.forClass(
CompositeHealthIndicatorConfiguration.class, getClass())
Class<?>[] generics = ResolvableType
.forClass(CompositeHealthIndicatorConfiguration.class, getClass())
.resolveGenerics();
Class<H> indicatorClass = (Class<H>) generics[0];
Class<S> sourceClass = (Class<S>) generics[1];
@ -211,8 +211,7 @@ public class HealthIndicatorAutoConfiguration {
@Configuration
@ConditionalOnBean(RedisConnectionFactory.class)
@ConditionalOnEnabledHealthIndicator("redis")
public static class RedisHealthIndicatorConfiguration
extends
public static class RedisHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration<RedisHealthIndicator, RedisConnectionFactory> {
@Autowired
@ -281,8 +280,7 @@ public class HealthIndicatorAutoConfiguration {
@Configuration
@ConditionalOnBean(JavaMailSenderImpl.class)
@ConditionalOnEnabledHealthIndicator("mail")
public static class MailHealthIndicatorConfiguration
extends
public static class MailHealthIndicatorConfiguration extends
CompositeHealthIndicatorConfiguration<MailHealthIndicator, JavaMailSenderImpl> {
@Autowired(required = false)

View File

@ -50,8 +50,8 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
*
* <p>
* Additional configuration parameters for Jolokia can be provided by specifying
* {@code jolokia.config.*} properties. See the <a
* href="http://jolokia.org">http://jolokia.org</a> web site for more information on
* {@code jolokia.config.*} properties. See the
* <a href="http://jolokia.org">http://jolokia.org</a> web site for more information on
* supported configuration parameters.
*
* @author Christian Dupuis

View File

@ -39,16 +39,16 @@ import org.springframework.core.type.AnnotationMetadata;
* @see ManagementContextConfiguration
*/
@Order(Ordered.LOWEST_PRECEDENCE)
class ManagementContextConfigurationsImportSelector implements DeferredImportSelector,
BeanClassLoaderAware {
class ManagementContextConfigurationsImportSelector
implements DeferredImportSelector, BeanClassLoaderAware {
private ClassLoader classLoader;
@Override
public String[] selectImports(AnnotationMetadata metadata) {
// Find all possible auto configuration classes, filtering duplicates
List<String> factories = new ArrayList<String>(new LinkedHashSet<String>(
SpringFactoriesLoader.loadFactoryNames(
List<String> factories = new ArrayList<String>(
new LinkedHashSet<String>(SpringFactoriesLoader.loadFactoryNames(
ManagementContextConfiguration.class, this.classLoader)));
AnnotationAwareOrderComparator.sort(factories);
return factories.toArray(new String[0]);

View File

@ -101,8 +101,8 @@ public class ManagementWebSecurityAutoConfiguration {
}
@Configuration
protected static class ManagementSecurityPropertiesConfiguration implements
SecurityPrerequisite {
protected static class ManagementSecurityPropertiesConfiguration
implements SecurityPrerequisite {
@Autowired(required = false)
private SecurityProperties security;
@ -122,8 +122,8 @@ public class ManagementWebSecurityAutoConfiguration {
// Get the ignored paths in early
@Order(SecurityProperties.IGNORED_ORDER + 1)
private static class IgnoredPathsWebSecurityConfigurerAdapter implements
WebSecurityConfigurer<WebSecurity> {
private static class IgnoredPathsWebSecurityConfigurerAdapter
implements WebSecurityConfigurer<WebSecurity> {
@Autowired(required = false)
private ErrorController errorController;
@ -152,8 +152,8 @@ public class ManagementWebSecurityAutoConfiguration {
List<String> ignored = SpringBootWebSecurityConfiguration
.getIgnored(this.security);
if (!this.management.getSecurity().isEnabled()) {
ignored.addAll(Arrays.asList(EndpointPaths.ALL
.getPaths(this.endpointHandlerMapping)));
ignored.addAll(Arrays
.asList(EndpointPaths.ALL.getPaths(this.endpointHandlerMapping)));
}
if (ignored.contains("none")) {
ignored.remove("none");
@ -192,12 +192,13 @@ public class ManagementWebSecurityAutoConfiguration {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
String managementEnabled = context.getEnvironment().getProperty(
"management.security.enabled", "true");
String basicEnabled = context.getEnvironment().getProperty(
"security.basic.enabled", "true");
return new ConditionOutcome("true".equalsIgnoreCase(managementEnabled)
&& !"true".equalsIgnoreCase(basicEnabled),
String managementEnabled = context.getEnvironment()
.getProperty("management.security.enabled", "true");
String basicEnabled = context.getEnvironment()
.getProperty("security.basic.enabled", "true");
return new ConditionOutcome(
"true".equalsIgnoreCase(managementEnabled)
&& !"true".equalsIgnoreCase(basicEnabled),
"Management security enabled and basic disabled");
}
@ -207,8 +208,8 @@ public class ManagementWebSecurityAutoConfiguration {
@ConditionalOnMissingBean({ ManagementWebSecurityConfigurerAdapter.class })
@ConditionalOnProperty(prefix = "management.security", name = "enabled", matchIfMissing = true)
@Order(ManagementServerProperties.BASIC_AUTH_ORDER)
protected static class ManagementWebSecurityConfigurerAdapter extends
WebSecurityConfigurerAdapter {
protected static class ManagementWebSecurityConfigurerAdapter
extends WebSecurityConfigurerAdapter {
@Autowired
private SecurityProperties security;
@ -234,8 +235,8 @@ public class ManagementWebSecurityAutoConfiguration {
if (this.endpointHandlerMapping == null) {
ApplicationContext context = (this.contextResolver == null ? null
: this.contextResolver.getApplicationContext());
if (context != null
&& context.getBeanNamesForType(EndpointHandlerMapping.class).length > 0) {
if (context != null && context
.getBeanNamesForType(EndpointHandlerMapping.class).length > 0) {
this.endpointHandlerMapping = context
.getBean(EndpointHandlerMapping.class);
}

View File

@ -116,9 +116,8 @@ public class MetricExportAutoConfiguration {
@ConditionalOnMissingBean
public MetricExportProperties metricExportProperties() {
MetricExportProperties export = new MetricExportProperties();
export.getRedis().setPrefix(
"spring.metrics" + (this.prefix.length() > 0 ? "." : "")
+ this.prefix);
export.getRedis().setPrefix("spring.metrics"
+ (this.prefix.length() > 0 ? "." : "") + this.prefix);
export.getAggregate().setPrefix(this.prefix);
export.getAggregate().setKeyPattern(this.aggregateKeyPattern);
return export;

View File

@ -50,13 +50,16 @@ public class MetricsDropwizardAutoConfiguration {
@Bean
@ConditionalOnMissingBean({ DropwizardMetricServices.class, CounterService.class,
GaugeService.class })
public DropwizardMetricServices dropwizardMetricServices(MetricRegistry metricRegistry) {
public DropwizardMetricServices dropwizardMetricServices(
MetricRegistry metricRegistry) {
return new DropwizardMetricServices(metricRegistry);
}
@Bean
public MetricReaderPublicMetrics dropwizardPublicMetrics(MetricRegistry metricRegistry) {
MetricRegistryMetricReader reader = new MetricRegistryMetricReader(metricRegistry);
public MetricReaderPublicMetrics dropwizardPublicMetrics(
MetricRegistry metricRegistry) {
MetricRegistryMetricReader reader = new MetricRegistryMetricReader(
metricRegistry);
return new MetricReaderPublicMetrics(reader);
}

View File

@ -61,6 +61,7 @@ final class MetricsFilter extends OncePerRequestFilter {
private final GaugeService gaugeService;
private static final Set<PatternReplacer> STATUS_REPLACERS;
static {
Set<PatternReplacer> replacements = new LinkedHashSet<PatternReplacer>();
replacements.add(new PatternReplacer("[{}]", 0, "-"));
@ -72,6 +73,7 @@ final class MetricsFilter extends OncePerRequestFilter {
}
private static final Set<PatternReplacer> KEY_REPLACERS;
static {
Set<PatternReplacer> replacements = new LinkedHashSet<PatternReplacer>();
replacements.add(new PatternReplacer("/", Pattern.LITERAL, "."));
@ -217,8 +219,8 @@ final class MetricsFilter extends OncePerRequestFilter {
}
public String apply(String input) {
return this.pattern.matcher(input).replaceAll(
Matcher.quoteReplacement(this.replacement));
return this.pattern.matcher(input)
.replaceAll(Matcher.quoteReplacement(this.replacement));
}
}

View File

@ -37,8 +37,8 @@ class OnEnabledHealthIndicatorCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata
.getAnnotationAttributes(ANNOTATION_CLASS));
AnnotationAttributes annotationAttributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(ANNOTATION_CLASS));
String endpointName = annotationAttributes.getString("value");
ConditionOutcome outcome = getHealthIndicatorOutcome(context, endpointName);
if (outcome != null) {

View File

@ -144,8 +144,8 @@ public class PublicMetricsAutoConfiguration {
@ConditionalOnMissingBean
public MetricReaderPublicMetrics springIntegrationPublicMetrics(
IntegrationMBeanExporter exporter) {
return new MetricReaderPublicMetrics(new SpringIntegrationMetricReader(
exporter));
return new MetricReaderPublicMetrics(
new SpringIntegrationMetricReader(exporter));
}
}

View File

@ -41,8 +41,8 @@ import org.springframework.cache.CacheManager;
* @author Stephane Nicoll
* @since 1.3.0
*/
public abstract class AbstractJmxCacheStatisticsProvider<C extends Cache> implements
CacheStatisticsProvider<C> {
public abstract class AbstractJmxCacheStatisticsProvider<C extends Cache>
implements CacheStatisticsProvider<C> {
private static final Logger logger = LoggerFactory
.getLogger(AbstractJmxCacheStatisticsProvider.class);
@ -81,7 +81,8 @@ public abstract class AbstractJmxCacheStatisticsProvider<C extends Cache> implem
*/
protected abstract CacheStatistics getCacheStatistics(ObjectName objectName);
private ObjectName internalGetObjectName(C cache) throws MalformedObjectNameException {
private ObjectName internalGetObjectName(C cache)
throws MalformedObjectNameException {
String cacheName = cache.getName();
ObjectNameWrapper value = this.caches.get(cacheName);
if (value != null) {

View File

@ -25,8 +25,8 @@ import org.springframework.cache.concurrent.ConcurrentMapCache;
* @author Stephane Nicoll
* @since 1.3.0
*/
public class ConcurrentMapCacheStatisticsProvider implements
CacheStatisticsProvider<ConcurrentMapCache> {
public class ConcurrentMapCacheStatisticsProvider
implements CacheStatisticsProvider<ConcurrentMapCache> {
@Override
public CacheStatistics getCacheStatistics(CacheManager cacheManager,

View File

@ -30,7 +30,8 @@ import com.google.common.cache.CacheStats;
public class GuavaCacheStatisticsProvider implements CacheStatisticsProvider<GuavaCache> {
@Override
public CacheStatistics getCacheStatistics(CacheManager cacheManager, GuavaCache cache) {
public CacheStatistics getCacheStatistics(CacheManager cacheManager,
GuavaCache cache) {
DefaultCacheStatistics statistics = new DefaultCacheStatistics();
statistics.setSize(cache.getNativeCache().size());
CacheStats guavaStats = cache.getNativeCache().stats();

View File

@ -28,8 +28,8 @@ import com.hazelcast.spring.cache.HazelcastCache;
* @author Stephane Nicoll
* @since 1.3.0
*/
public class HazelcastCacheStatisticsProvider implements
CacheStatisticsProvider<HazelcastCache> {
public class HazelcastCacheStatisticsProvider
implements CacheStatisticsProvider<HazelcastCache> {
@Override
public CacheStatistics getCacheStatistics(CacheManager cacheManager,

View File

@ -30,15 +30,15 @@ import org.infinispan.spring.provider.SpringCache;
* @author Stephane Nicoll
* @since 1.3.0
*/
public class InfinispanCacheStatisticsProvider extends
AbstractJmxCacheStatisticsProvider<SpringCache> {
public class InfinispanCacheStatisticsProvider
extends AbstractJmxCacheStatisticsProvider<SpringCache> {
@Override
protected ObjectName getObjectName(SpringCache cache)
throws MalformedObjectNameException {
ObjectName name = new ObjectName(
"org.infinispan:component=Statistics,type=Cache,name=\""
+ cache.getName() + "(local)\",*");
"org.infinispan:component=Statistics,type=Cache,name=\"" + cache.getName()
+ "(local)\",*");
Set<ObjectInstance> instances = getMBeanServer().queryMBeans(name, null);
if (instances.size() == 1) {
return instances.iterator().next().getObjectName();
@ -61,7 +61,8 @@ public class InfinispanCacheStatisticsProvider extends
return statistics;
}
private void initalizeStats(ObjectName objectName, DefaultCacheStatistics statistics) {
private void initalizeStats(ObjectName objectName,
DefaultCacheStatistics statistics) {
Double hitRatio = getAttribute(objectName, "hitRatio", Double.class);
if ((hitRatio != null)) {
statistics.setHitRatio(hitRatio);

View File

@ -30,14 +30,14 @@ import org.springframework.cache.jcache.JCacheCache;
* @author Stephane Nicoll
* @since 1.3.0
*/
public class JCacheCacheStatisticsProvider extends
AbstractJmxCacheStatisticsProvider<JCacheCache> {
public class JCacheCacheStatisticsProvider
extends AbstractJmxCacheStatisticsProvider<JCacheCache> {
@Override
protected ObjectName getObjectName(JCacheCache cache)
throws MalformedObjectNameException {
ObjectName name = new ObjectName("javax.cache:type=CacheStatistics,Cache="
+ cache.getName() + ",*");
ObjectName name = new ObjectName(
"javax.cache:type=CacheStatistics,Cache=" + cache.getName() + ",*");
Set<ObjectInstance> instances = getMBeanServer().queryMBeans(name, null);
if (instances.size() == 1) {
return instances.iterator().next().getObjectName();

View File

@ -37,8 +37,8 @@ class OnEnabledEndpointCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(metadata
.getAnnotationAttributes(ANNOTATION_CLASS));
AnnotationAttributes annotationAttributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(ANNOTATION_CLASS));
String endpointName = annotationAttributes.getString("value");
boolean enabledByDefault = annotationAttributes.getBoolean("enabledByDefault");
ConditionOutcome outcome = determineEndpointOutcome(endpointName,
@ -66,8 +66,8 @@ class OnEnabledEndpointCondition extends SpringBootCondition {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), "endpoints.");
boolean match = Boolean.valueOf(resolver.getProperty("enabled", "true"));
return new ConditionOutcome(match, "All endpoints are "
+ (match ? "enabled" : "disabled") + " by default");
return new ConditionOutcome(match,
"All endpoints are " + (match ? "enabled" : "disabled") + " by default");
}
}

View File

@ -87,12 +87,12 @@ public class CachePublicMetrics implements PublicMetrics {
private CacheStatistics getCacheStatistics(Cache cache, CacheManager cacheManager) {
if (this.statisticsProviders != null) {
for (CacheStatisticsProvider provider : this.statisticsProviders) {
Class<?> cacheType = ResolvableType.forClass(
CacheStatisticsProvider.class, provider.getClass())
Class<?> cacheType = ResolvableType
.forClass(CacheStatisticsProvider.class, provider.getClass())
.resolveGeneric();
if (cacheType.isInstance(cache)) {
CacheStatistics statistics = provider.getCacheStatistics(
cacheManager, cache);
CacheStatistics statistics = provider.getCacheStatistics(cacheManager,
cache);
if (statistics != null) {
return statistics;
}

View File

@ -59,8 +59,8 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
* @author Dave Syer
*/
@ConfigurationProperties(prefix = "endpoints.configprops", ignoreUnknownFields = false)
public class ConfigurationPropertiesReportEndpoint extends
AbstractEndpoint<Map<String, Object>> implements ApplicationContextAware {
public class ConfigurationPropertiesReportEndpoint
extends AbstractEndpoint<Map<String, Object>> implements ApplicationContextAware {
private static final String CGLIB_FILTER_ID = "cglibFilter";
@ -101,7 +101,8 @@ public class ConfigurationPropertiesReportEndpoint extends
private Map<String, Object> extract(ApplicationContext context, ObjectMapper mapper) {
Map<String, Object> result = new HashMap<String, Object>();
ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(context);
ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(
context);
Map<String, Object> beans = getConfigurationPropertiesBeans(context,
beanFactoryMetaData);
for (Map.Entry<String, Object> entry : beans.entrySet()) {
@ -153,8 +154,8 @@ public class ConfigurationPropertiesReportEndpoint extends
String prefix) {
try {
@SuppressWarnings("unchecked")
Map<String, Object> result = new HashMap<String, Object>(mapper.convertValue(
bean, Map.class));
Map<String, Object> result = new HashMap<String, Object>(
mapper.convertValue(bean, Map.class));
return result;
}
catch (Exception ex) {
@ -210,8 +211,8 @@ public class ConfigurationPropertiesReportEndpoint extends
ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
ConfigurationProperties.class);
if (beanFactoryMetaData != null) {
ConfigurationProperties override = beanFactoryMetaData.findFactoryAnnotation(
beanName, ConfigurationProperties.class);
ConfigurationProperties override = beanFactoryMetaData
.findFactoryAnnotation(beanName, ConfigurationProperties.class);
if (override != null) {
// The @Bean-level @ConfigurationProperties overrides the one at type
// level when binding. Arguably we should render them both, but this one
@ -249,8 +250,8 @@ public class ConfigurationPropertiesReportEndpoint extends
* properties.
*/
@SuppressWarnings("serial")
private static class CglibAnnotationIntrospector extends
JacksonAnnotationIntrospector {
private static class CglibAnnotationIntrospector
extends JacksonAnnotationIntrospector {
@Override
public Object findFilterId(Annotated a) {
@ -312,9 +313,8 @@ public class ConfigurationPropertiesReportEndpoint extends
// that its a nested class used solely for binding to config props, so it
// should be kosher. This filter is not used if there is JSON metadata for
// the property, so it's mainly for user-defined beans.
return (setter != null)
|| ClassUtils.getPackageName(parentType).equals(
ClassUtils.getPackageName(type));
return (setter != null) || ClassUtils.getPackageName(parentType)
.equals(ClassUtils.getPackageName(type));
}
private AnnotatedMethod findSetter(BeanDescription beanDesc,

View File

@ -35,7 +35,8 @@ class Sanitizer {
private Pattern[] keysToSanitize;
Sanitizer() {
setKeysToSanitize("password", "secret", "key", ".*credentials.*", "vcap_services");
setKeysToSanitize("password", "secret", "key", ".*credentials.*",
"vcap_services");
}
/**

View File

@ -58,7 +58,8 @@ public class EndpointMBean {
* @param endpoint the endpoint to wrap
* @param objectMapper the {@link ObjectMapper} used to convert the payload
*/
public EndpointMBean(String beanName, Endpoint<?> endpoint, ObjectMapper objectMapper) {
public EndpointMBean(String beanName, Endpoint<?> endpoint,
ObjectMapper objectMapper) {
Assert.notNull(beanName, "BeanName must not be null");
Assert.notNull(endpoint, "Endpoint must not be null");
Assert.notNull(objectMapper, "ObjectMapper must not be null");

View File

@ -58,8 +58,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
* @author Christian Dupuis
* @author Andy Wilkinson
*/
public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecycle,
ApplicationContextAware {
public class EndpointMBeanExporter extends MBeanExporter
implements SmartLifecycle, ApplicationContextAware {
/**
* The default JMX domain.
@ -139,7 +139,8 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
}
@Override
public void setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames) {
public void setEnsureUniqueRuntimeObjectNames(
boolean ensureUniqueRuntimeObjectNames) {
super.setEnsureUniqueRuntimeObjectNames(ensureUniqueRuntimeObjectNames);
this.ensureUniqueRuntimeObjectNames = ensureUniqueRuntimeObjectNames;
}
@ -209,9 +210,8 @@ public class EndpointMBeanExporter extends MBeanExporter implements SmartLifecyc
+ ObjectUtils.getIdentityHexString(this.applicationContext));
}
if (this.ensureUniqueRuntimeObjectNames) {
builder.append(",identity="
+ ObjectUtils.getIdentityHexString(((EndpointMBean) bean)
.getEndpoint()));
builder.append(",identity=" + ObjectUtils
.getIdentityHexString(((EndpointMBean) bean).getEndpoint()));
}
builder.append(getStaticNames());
return ObjectNameManager.getInstance(builder.toString());

View File

@ -29,8 +29,8 @@ import org.springframework.util.Assert;
* @author Phillip Webb
* @since 1.3.0
*/
public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>> implements
MvcEndpoint {
public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>>
implements MvcEndpoint {
private final E delegate;

View File

@ -40,8 +40,8 @@ import org.springframework.web.servlet.resource.TransformedResource;
* @author Andy Wilkinson
* @since 1.3.0
*/
public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint implements
ResourceLoaderAware {
public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint
implements ResourceLoaderAware {
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
@ -86,7 +86,8 @@ public class ActuatorHalBrowserEndpoint extends ActuatorHalJsonEndpoint implemen
}
}
public static HalBrowserLocation getHalBrowserLocation(ResourceLoader resourceLoader) {
public static HalBrowserLocation getHalBrowserLocation(
ResourceLoader resourceLoader) {
for (HalBrowserLocation candidate : HAL_BROWSER_RESOURCE_LOCATIONS) {
try {
Resource resource = resourceLoader.getResource(candidate.toString());

View File

@ -37,8 +37,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
* @since 1.3.0
*/
@ConfigurationProperties("endpoints.actuator")
public class ActuatorHalJsonEndpoint extends WebMvcConfigurerAdapter implements
MvcEndpoint {
public class ActuatorHalJsonEndpoint extends WebMvcConfigurerAdapter
implements MvcEndpoint {
/**
* Endpoint URL path.

View File

@ -58,13 +58,14 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean {
this.endpoints.addAll(existing);
this.customTypes = findEndpointClasses(existing);
@SuppressWarnings("rawtypes")
Collection<Endpoint> delegates = BeanFactoryUtils.beansOfTypeIncludingAncestors(
this.applicationContext, Endpoint.class).values();
Collection<Endpoint> delegates = BeanFactoryUtils
.beansOfTypeIncludingAncestors(this.applicationContext, Endpoint.class)
.values();
for (Endpoint<?> endpoint : delegates) {
if (isGenericEndpoint(endpoint.getClass()) && endpoint.isEnabled()) {
EndpointMvcAdapter adapter = new EndpointMvcAdapter(endpoint);
String path = this.applicationContext.getEnvironment().getProperty(
"endpoints." + endpoint.getId() + ".path");
String path = this.applicationContext.getEnvironment()
.getProperty("endpoints." + endpoint.getId() + ".path");
if (path != null) {
adapter.setPath(path);
}

View File

@ -47,8 +47,8 @@ public class CassandraHealthIndicator extends AbstractHealthIndicator {
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
try {
Select select = QueryBuilder.select("release_version")
.from("system", "local");
Select select = QueryBuilder.select("release_version").from("system",
"local");
ResultSet results = this.cassandraAdminOperations.query(select);
if (results.isExhausted()) {
builder.up();

View File

@ -46,8 +46,8 @@ import org.springframework.util.StringUtils;
* @author Arthur Kalimullin
* @since 1.1.0
*/
public class DataSourceHealthIndicator extends AbstractHealthIndicator implements
InitializingBean {
public class DataSourceHealthIndicator extends AbstractHealthIndicator
implements InitializingBean {
private static final String DEFAULT_QUERY = "SELECT 1";
@ -121,8 +121,8 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement
private String getProduct() {
return this.jdbcTemplate.execute(new ConnectionCallback<String>() {
@Override
public String doInConnection(Connection connection) throws SQLException,
DataAccessException {
public String doInConnection(Connection connection)
throws SQLException, DataAccessException {
return connection.getMetaData().getDatabaseProductName();
}
});

View File

@ -46,9 +46,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator {
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
List<String> indices = this.properties.getIndices();
ClusterHealthResponse response = this.client
.admin()
.cluster()
ClusterHealthResponse response = this.client.admin().cluster()
.health(Requests.clusterHealthRequest(indices.isEmpty() ? allIndices
: indices.toArray(new String[indices.size()])))
.actionGet(this.properties.getResponseTimeout());

View File

@ -121,16 +121,19 @@ public class AggregateMetricReader implements MetricReader {
String name = this.prefix + key;
Metric<?> aggregate = result.findOne(name);
if (aggregate == null) {
aggregate = new Metric<Number>(name, metric.getValue(), metric.getTimestamp());
aggregate = new Metric<Number>(name, metric.getValue(),
metric.getTimestamp());
}
else if (key.contains("counter.")) {
// accumulate all values
aggregate = new Metric<Number>(name, metric.increment(
aggregate.getValue().intValue()).getValue(), metric.getTimestamp());
aggregate = new Metric<Number>(name,
metric.increment(aggregate.getValue().intValue()).getValue(),
metric.getTimestamp());
}
else if (aggregate.getTimestamp().before(metric.getTimestamp())) {
// sort by timestamp and only take the latest
aggregate = new Metric<Number>(name, metric.getValue(), metric.getTimestamp());
aggregate = new Metric<Number>(name, metric.getValue(),
metric.getTimestamp());
}
result.set(aggregate);
}

View File

@ -81,7 +81,8 @@ public class BufferMetricReader implements MetricReader, PrefixMetricReader {
}
private <T extends Number, B extends Buffer<T>> void collectMetrics(
Buffers<B> buffers, Predicate<String> predicate, final List<Metric<?>> metrics) {
Buffers<B> buffers, Predicate<String> predicate,
final List<Metric<?>> metrics) {
buffers.forEach(predicate, new BiConsumer<String, B>() {
@Override

View File

@ -52,8 +52,8 @@ public abstract class AbstractMetricExporter implements Exporter {
private Date latestTimestamp = new Date(0L);
public AbstractMetricExporter(String prefix) {
this.prefix = (!StringUtils.hasText(prefix) ? "" : (prefix.endsWith(".") ? prefix
: prefix + "."));
this.prefix = (!StringUtils.hasText(prefix) ? ""
: (prefix.endsWith(".") ? prefix : prefix + "."));
}
/**

View File

@ -86,7 +86,8 @@ public class MetricExporters implements SchedulingConfigurer {
}
}
private MetricCopyExporter getExporter(MetricWriter writer, TriggerProperties trigger) {
private MetricCopyExporter getExporter(MetricWriter writer,
TriggerProperties trigger) {
MetricCopyExporter exporter = new MetricCopyExporter(this.reader, writer);
exporter.setIncludes(trigger.getIncludes());
exporter.setExcludes(trigger.getExcludes());

View File

@ -55,25 +55,25 @@ public class SpringIntegrationMetricReader implements MetricReader {
String prefix = "integration.channel." + name;
metrics.addAll(getStatistics(prefix + ".errorRate",
exporter.getChannelErrorRate(name)));
metrics.add(new Metric<Long>(prefix + ".sendCount", exporter
.getChannelSendCountLong(name)));
metrics.add(new Metric<Long>(prefix + ".sendCount",
exporter.getChannelSendCountLong(name)));
metrics.addAll(getStatistics(prefix + ".sendRate",
exporter.getChannelSendRate(name)));
metrics.add(new Metric<Long>(prefix + ".receiveCount", exporter
.getChannelReceiveCountLong(name)));
metrics.add(new Metric<Long>(prefix + ".receiveCount",
exporter.getChannelReceiveCountLong(name)));
}
for (String name : exporter.getHandlerNames()) {
metrics.addAll(getStatistics("integration.handler." + name + ".duration",
exporter.getHandlerDuration(name)));
}
metrics.add(new Metric<Integer>("integration.activeHandlerCount", exporter
.getActiveHandlerCount()));
metrics.add(new Metric<Integer>("integration.handlerCount", exporter
.getHandlerCount()));
metrics.add(new Metric<Integer>("integration.channelCount", exporter
.getChannelCount()));
metrics.add(new Metric<Integer>("integration.queuedMessageCount", exporter
.getQueuedMessageCount()));
metrics.add(new Metric<Integer>("integration.activeHandlerCount",
exporter.getActiveHandlerCount()));
metrics.add(new Metric<Integer>("integration.handlerCount",
exporter.getHandlerCount()));
metrics.add(new Metric<Integer>("integration.channelCount",
exporter.getChannelCount()));
metrics.add(new Metric<Integer>("integration.queuedMessageCount",
exporter.getQueuedMessageCount()));
return metrics;
}
@ -83,7 +83,8 @@ public class SpringIntegrationMetricReader implements MetricReader {
metrics.add(new Metric<Double>(name + ".mean", statistic.getMean()));
metrics.add(new Metric<Double>(name + ".max", statistic.getMax()));
metrics.add(new Metric<Double>(name + ".min", statistic.getMin()));
metrics.add(new Metric<Double>(name + ".stdev", statistic.getStandardDeviation()));
metrics.add(
new Metric<Double>(name + ".stdev", statistic.getStandardDeviation()));
metrics.add(new Metric<Long>(name + ".count", statistic.getCountLong()));
return metrics;
}

View File

@ -69,7 +69,8 @@ public class OpenTsdbMetricWriter implements MetricWriter {
*/
private MediaType mediaType = MediaType.APPLICATION_JSON;
private final List<OpenTsdbData> buffer = new ArrayList<OpenTsdbData>(this.bufferSize);
private final List<OpenTsdbData> buffer = new ArrayList<OpenTsdbData>(
this.bufferSize);
private OpenTsdbNamingStrategy namingStrategy = new DefaultOpenTsdbNamingStrategy();
@ -104,9 +105,8 @@ public class OpenTsdbMetricWriter implements MetricWriter {
@Override
public void set(Metric<?> value) {
OpenTsdbData data = new OpenTsdbData(
this.namingStrategy.getName(value.getName()), value.getValue(), value
.getTimestamp().getTime());
OpenTsdbData data = new OpenTsdbData(this.namingStrategy.getName(value.getName()),
value.getValue(), value.getTimestamp().getTime());
synchronized (this.buffer) {
this.buffer.add(data);
if (this.buffer.size() >= this.bufferSize) {

View File

@ -53,8 +53,8 @@ public class InMemoryMetricRepository implements MetricRepository, MultiMetricRe
public Metric<?> modify(Metric<?> current) {
if (current != null) {
Metric<? extends Number> metric = current;
return new Metric<Long>(metricName, metric.increment(amount)
.getValue(), timestamp);
return new Metric<Long>(metricName,
metric.increment(amount).getValue(), timestamp);
}
else {
return new Metric<Long>(metricName, new Long(amount), timestamp);

View File

@ -98,8 +98,8 @@ public class StatsdMetricWriter implements MetricWriter, Closeable {
this.client.stop();
}
private static final class LoggingStatsdErrorHandler implements
StatsDClientErrorHandler {
private static final class LoggingStatsdErrorHandler
implements StatsDClientErrorHandler {
@Override
public void handle(Exception e) {

View File

@ -56,14 +56,15 @@ import org.springframework.util.Assert;
* @author Tomasz Przybyla
* @since 1.2.0
*/
public class ApplicationPidFileWriter implements
ApplicationListener<SpringApplicationEvent>, Ordered {
public class ApplicationPidFileWriter
implements ApplicationListener<SpringApplicationEvent>, Ordered {
private static final Log logger = LogFactory.getLog(ApplicationPidFileWriter.class);
private static final String DEFAULT_FILE_NAME = "application.pid";
private static final List<Property> FILE_PROPERTIES;
static {
List<Property> properties = new ArrayList<Property>();
properties.add(new SpringProperty("spring.pid.", "file"));
@ -73,6 +74,7 @@ public class ApplicationPidFileWriter implements
}
private static final List<Property> FAIL_ON_WRITE_ERROR_PROPERTIES;
static {
List<Property> properties = new ArrayList<Property>();
properties.add(new SpringProperty("spring.pid.", "fail-on-write-error"));
@ -116,9 +118,9 @@ public class ApplicationPidFileWriter implements
/**
* Sets the type of application event that will trigger writing of the PID file.
* Defaults to {@link ApplicationPreparedEvent}. NOTE: If you use the
* {@link org.springframework.boot.context.event.ApplicationStartedEvent}
* to trigger the write, you will not be able to
* specify the PID filename in the Spring {@link Environment}.
* {@link org.springframework.boot.context.event.ApplicationStartedEvent} to trigger
* the write, you will not be able to specify the PID filename in the Spring
* {@link Environment}.
* @param triggerEventType the trigger event type
*/
public void setTriggerEventType(
@ -135,8 +137,8 @@ public class ApplicationPidFileWriter implements
writePidFile(event);
}
catch (Exception ex) {
String message = String
.format("Cannot create pid file %s", this.file);
String message = String.format("Cannot create pid file %s",
this.file);
if (failOnWriteError(event)) {
throw new IllegalStateException(message, ex);
}

View File

@ -78,16 +78,16 @@ public class CacheStatisticsAutoConfigurationTests {
@Test
public void basicJCacheCacheStatistics() {
load(JCacheCacheConfig.class);
CacheStatisticsProvider provider = this.context.getBean(
"jCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
CacheStatisticsProvider provider = this.context
.getBean("jCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
doTestCoreStatistics(provider, false);
}
@Test
public void basicEhCacheCacheStatistics() {
load(EhCacheConfig.class);
CacheStatisticsProvider provider = this.context.getBean(
"ehCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
CacheStatisticsProvider provider = this.context
.getBean("ehCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
doTestCoreStatistics(provider, true);
}
@ -110,8 +110,8 @@ public class CacheStatisticsAutoConfigurationTests {
@Test
public void basicGuavaCacheStatistics() {
load(GuavaConfig.class);
CacheStatisticsProvider provider = this.context.getBean(
"guavaCacheStatisticsProvider", CacheStatisticsProvider.class);
CacheStatisticsProvider provider = this.context
.getBean("guavaCacheStatisticsProvider", CacheStatisticsProvider.class);
doTestCoreStatistics(provider, true);
}
@ -125,23 +125,23 @@ public class CacheStatisticsAutoConfigurationTests {
books);
assertCoreStatistics(cacheStatistics, 0L, null, null);
getOrCreate(books, "a", "b", "b", "a", "a");
CacheStatistics updatedCacheStatistics = provider.getCacheStatistics(
this.cacheManager, books);
CacheStatistics updatedCacheStatistics = provider
.getCacheStatistics(this.cacheManager, books);
assertCoreStatistics(updatedCacheStatistics, 2L, null, null);
}
@Test
public void noOpCacheStatistics() {
load(NoOpCacheConfig.class);
CacheStatisticsProvider provider = this.context.getBean(
"noOpCacheStatisticsProvider", CacheStatisticsProvider.class);
CacheStatisticsProvider provider = this.context
.getBean("noOpCacheStatisticsProvider", CacheStatisticsProvider.class);
Cache books = getCache("books");
CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
books);
assertCoreStatistics(cacheStatistics, null, null, null);
getOrCreate(books, "a", "b", "b", "a", "a");
CacheStatistics updatedCacheStatistics = provider.getCacheStatistics(
this.cacheManager, books);
CacheStatistics updatedCacheStatistics = provider
.getCacheStatistics(this.cacheManager, books);
assertCoreStatistics(updatedCacheStatistics, null, null, null);
}
@ -152,14 +152,14 @@ public class CacheStatisticsAutoConfigurationTests {
books);
assertCoreStatistics(cacheStatistics, (supportSize ? 0L : null), null, null);
getOrCreate(books, "a", "b", "b", "a", "a", "a");
CacheStatistics updatedCacheStatistics = provider.getCacheStatistics(
this.cacheManager, books);
CacheStatistics updatedCacheStatistics = provider
.getCacheStatistics(this.cacheManager, books);
assertCoreStatistics(updatedCacheStatistics, (supportSize ? 2L : null), 0.66D,
0.33D);
}
private void assertCoreStatistics(CacheStatistics metrics, Long size,
Double hitRatio, Double missRatio) {
private void assertCoreStatistics(CacheStatistics metrics, Long size, Double hitRatio,
Double missRatio) {
assertNotNull("Cache metrics must not be null", metrics);
assertEquals("Wrong size for metrics " + metrics, size, metrics.getSize());
checkRatio("Wrong hit ratio for metrics " + metrics, hitRatio,
@ -213,8 +213,9 @@ public class CacheStatisticsAutoConfigurationTests {
@Bean
public javax.cache.CacheManager jCacheCacheManager() {
javax.cache.CacheManager cacheManager = Caching.getCachingProvider(
HazelcastCachingProvider.class.getName()).getCacheManager();
javax.cache.CacheManager cacheManager = Caching
.getCachingProvider(HazelcastCachingProvider.class.getName())
.getCacheManager();
MutableConfiguration<Object, Object> config = new MutableConfiguration<Object, Object>();
config.setStatisticsEnabled(true);
cacheManager.createCache("books", config);
@ -234,8 +235,8 @@ public class CacheStatisticsAutoConfigurationTests {
@Bean
public net.sf.ehcache.CacheManager ehCacheCacheManager() {
return EhCacheManagerUtils.buildCacheManager(new ClassPathResource(
"cache/test-ehcache.xml"));
return EhCacheManagerUtils
.buildCacheManager(new ClassPathResource("cache/test-ehcache.xml"));
}
}

View File

@ -86,8 +86,8 @@ public class EndpointMvcIntegrationTests {
@Test
public void envEndpointHidden() throws InterruptedException {
String body = new TestRestTemplate().getForObject("http://localhost:" + this.port
+ "/env/user.dir", String.class);
String body = new TestRestTemplate().getForObject(
"http://localhost:" + this.port + "/env/user.dir", String.class);
assertNotNull(body);
assertTrue("Wrong body: \n" + body, body.contains("spring-boot-actuator"));
assertTrue(this.interceptor.invoked());
@ -95,8 +95,8 @@ public class EndpointMvcIntegrationTests {
@Test
public void healthEndpointNotHidden() throws InterruptedException {
String body = new TestRestTemplate().getForObject("http://localhost:" + this.port
+ "/health", String.class);
String body = new TestRestTemplate()
.getForObject("http://localhost:" + this.port + "/health", String.class);
assertNotNull(body);
assertTrue("Wrong body: \n" + body, body.contains("status"));
assertTrue(this.interceptor.invoked());

View File

@ -145,8 +145,8 @@ public class EndpointWebMvcAutoConfigurationTests {
assertContent("/endpoint", ports.get().server, null);
assertContent("/controller", ports.get().management, null);
assertContent("/endpoint", ports.get().management, "endpointoutput");
ApplicationContext managementContext = this.applicationContext.getBean(
ManagementContextResolver.class).getApplicationContext();
ApplicationContext managementContext = this.applicationContext
.getBean(ManagementContextResolver.class).getApplicationContext();
List<?> interceptors = (List<?>) ReflectionTestUtils.getField(
managementContext.getBean(EndpointHandlerMapping.class), "interceptors");
assertEquals(1, interceptors.size());
@ -160,10 +160,10 @@ public class EndpointWebMvcAutoConfigurationTests {
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
ServletContext servletContext = mock(ServletContext.class);
given(servletContext.getInitParameterNames()).willReturn(
new Vector<String>().elements());
given(servletContext.getAttributeNames()).willReturn(
new Vector<String>().elements());
given(servletContext.getInitParameterNames())
.willReturn(new Vector<String>().elements());
given(servletContext.getAttributeNames())
.willReturn(new Vector<String>().elements());
this.applicationContext.setServletContext(servletContext);
this.applicationContext.refresh();
assertContent("/controller", ports.get().management, null);
@ -205,8 +205,9 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void specificPortsViaProperties() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext, "server.port:"
+ ports.get().server, "management.port:" + ports.get().management);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"server.port:" + ports.get().server,
"management.port:" + ports.get().management);
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ErrorMvcAutoConfiguration.class);
@ -245,8 +246,8 @@ public class EndpointWebMvcAutoConfigurationTests {
new ServerPortInfoApplicationContextInitializer()
.initialize(this.applicationContext);
this.applicationContext.refresh();
Integer localServerPort = this.applicationContext.getEnvironment().getProperty(
"local.server.port", Integer.class);
Integer localServerPort = this.applicationContext.getEnvironment()
.getProperty("local.server.port", Integer.class);
Integer localManagementPort = this.applicationContext.getEnvironment()
.getProperty("local.management.port", Integer.class);
assertThat(localServerPort, notNullValue());
@ -264,8 +265,8 @@ public class EndpointWebMvcAutoConfigurationTests {
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ErrorMvcAutoConfiguration.class);
this.applicationContext.refresh();
Integer localServerPort = this.applicationContext.getEnvironment().getProperty(
"local.server.port", Integer.class);
Integer localServerPort = this.applicationContext.getEnvironment()
.getProperty("local.server.port", Integer.class);
Integer localManagementPort = this.applicationContext.getEnvironment()
.getProperty("local.management.port", Integer.class);
assertThat(localServerPort, notNullValue());
@ -345,8 +346,9 @@ public class EndpointWebMvcAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"endpoints.shutdown.enabled:true");
this.applicationContext.refresh();
assertThat(this.applicationContext.getBeansOfType(ShutdownMvcEndpoint.class)
.size(), is(equalTo(1)));
assertThat(
this.applicationContext.getBeansOfType(ShutdownMvcEndpoint.class).size(),
is(equalTo(1)));
}
private void endpointDisabled(String name, Class<? extends MvcEndpoint> type) {
@ -378,8 +380,8 @@ public class EndpointWebMvcAutoConfigurationTests {
public void assertContent(String url, int port, Object expected) throws Exception {
SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI(
"http://localhost:" + port + url), HttpMethod.GET);
ClientHttpRequest request = clientHttpRequestFactory
.createRequest(new URI("http://localhost:" + port + url), HttpMethod.GET);
try {
ClientHttpResponse response = request.execute();
try {
@ -404,8 +406,8 @@ public class EndpointWebMvcAutoConfigurationTests {
public boolean hasHeader(String url, int port, String header) throws Exception {
SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
ClientHttpRequest request = clientHttpRequestFactory.createRequest(new URI(
"http://localhost:" + port + url), HttpMethod.GET);
ClientHttpRequest request = clientHttpRequestFactory
.createRequest(new URI("http://localhost:" + port + url), HttpMethod.GET);
ClientHttpResponse response = request.execute();
return response.getHeaders().containsKey(header);
}
@ -582,8 +584,8 @@ public class EndpointWebMvcAutoConfigurationTests {
}
private static class GrabManagementPort implements
ApplicationListener<EmbeddedServletContainerInitializedEvent> {
private static class GrabManagementPort
implements ApplicationListener<EmbeddedServletContainerInitializedEvent> {
private ApplicationContext rootContext;

View File

@ -99,8 +99,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(ApplicationHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Test
@ -113,8 +113,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertSame(this.context.getBean("customHealthIndicator"), beans.values()
.iterator().next());
assertSame(this.context.getBean("customHealthIndicator"),
beans.values().iterator().next());
}
@Test
@ -128,8 +128,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(DiskSpaceHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(DiskSpaceHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Test
@ -333,8 +333,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(MailHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(MailHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Test
@ -349,8 +349,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(ApplicationHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Test
@ -364,8 +364,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(JmsHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(JmsHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Test
@ -380,8 +380,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(ApplicationHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Test
@ -397,8 +397,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(ElasticsearchHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(ElasticsearchHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Test
@ -415,8 +415,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size());
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
.getClass());
assertEquals(ApplicationHealthIndicator.class,
beans.values().iterator().next().getClass());
}
@Configuration

View File

@ -59,8 +59,8 @@ public class HealthMvcEndpointAutoConfigurationTests {
this.context.setServletContext(new MockServletContext());
this.context.register(TestConfiguration.class);
this.context.refresh();
Health health = (Health) this.context.getBean(HealthMvcEndpoint.class).invoke(
null);
Health health = (Health) this.context.getBean(HealthMvcEndpoint.class)
.invoke(null);
assertEquals(Status.UP, health.getStatus());
assertEquals(null, health.getDetails().get("foo"));
}
@ -73,8 +73,8 @@ public class HealthMvcEndpointAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.context,
"management.security.enabled=false");
this.context.refresh();
Health health = (Health) this.context.getBean(HealthMvcEndpoint.class).invoke(
null);
Health health = (Health) this.context.getBean(HealthMvcEndpoint.class)
.invoke(null);
assertEquals(Status.UP, health.getStatus());
Health map = (Health) health.getDetails().get("test");
assertEquals("bar", map.getDetails().get("foo"));

View File

@ -88,11 +88,12 @@ public class JolokiaAutoConfigurationTests {
HttpMessageConvertersAutoConfiguration.class,
JolokiaAutoConfiguration.class);
this.context.refresh();
assertEquals(1, this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length);
assertEquals(1,
this.context.getBeanNamesForType(JolokiaMvcEndpoint.class).length);
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build();
mockMvc.perform(MockMvcRequestBuilders.get("/foo/bar")).andExpect(
MockMvcResultMatchers.content().string(
Matchers.containsString("\"request\":{\"type\"")));
mockMvc.perform(MockMvcRequestBuilders.get("/foo/bar"))
.andExpect(MockMvcResultMatchers.content()
.string(Matchers.containsString("\"request\":{\"type\"")));
}
@Test

View File

@ -85,12 +85,10 @@ public class ManagementContextPathHypermediaIntegrationTests {
@Test
public void trace() throws Exception {
this.mockMvc
.perform(get("/admin/trace").accept(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/admin/trace").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(
jsonPath("$._links.self.href").value(
"http://localhost/admin/trace"))
.andExpect(jsonPath("$._links.self.href")
.value("http://localhost/admin/trace"))
.andExpect(jsonPath("$.content").isArray());
}
@ -103,12 +101,10 @@ public class ManagementContextPathHypermediaIntegrationTests {
}
path = path.startsWith("/") ? path.substring(1) : path;
path = path.length() > 0 ? path : "self";
this.mockMvc
.perform(get("/admin").accept(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/admin").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(
jsonPath("$._links.%s.href", path).value(
"http://localhost/admin" + endpoint.getPath()));
.andExpect(jsonPath("$._links.%s.href", path)
.value("http://localhost/admin" + endpoint.getPath()));
}
}

View File

@ -99,7 +99,8 @@ public class ManagementWebSecurityAutoConfigurationTests {
assertThat(filterChainProxy.getFilters("/beans"), hasSize(greaterThan(0)));
assertThat(filterChainProxy.getFilters("/beans/"), hasSize(greaterThan(0)));
assertThat(filterChainProxy.getFilters("/beans.foo"), hasSize(greaterThan(0)));
assertThat(filterChainProxy.getFilters("/beans/foo/bar"), hasSize(greaterThan(0)));
assertThat(filterChainProxy.getFilters("/beans/foo/bar"),
hasSize(greaterThan(0)));
}
@Test
@ -115,9 +116,8 @@ public class ManagementWebSecurityAutoConfigurationTests {
this.context.register(WebConfiguration.class);
this.context.refresh();
UserDetails user = getUser();
assertTrue(user.getAuthorities().containsAll(
AuthorityUtils
.commaSeparatedStringToAuthorityList("ROLE_USER,ROLE_ADMIN")));
assertTrue(user.getAuthorities().containsAll(AuthorityUtils
.commaSeparatedStringToAuthorityList("ROLE_USER,ROLE_ADMIN")));
}
private UserDetails getUser() {
@ -125,8 +125,8 @@ public class ManagementWebSecurityAutoConfigurationTests {
.getBean(AuthenticationManager.class);
DaoAuthenticationProvider provider = (DaoAuthenticationProvider) parent
.getProviders().get(0);
UserDetailsService service = (UserDetailsService) ReflectionTestUtils.getField(
provider, "userDetailsService");
UserDetailsService service = (UserDetailsService) ReflectionTestUtils
.getField(provider, "userDetailsService");
UserDetails user = service.loadUserByUsername("user");
return user;
}
@ -143,8 +143,8 @@ public class ManagementWebSecurityAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.context, "security.ignored:none");
this.context.refresh();
// Just the application and management endpoints now
assertEquals(2, this.context.getBean(FilterChainProxy.class).getFilterChains()
.size());
assertEquals(2,
this.context.getBean(FilterChainProxy.class).getFilterChains().size());
}
@Test
@ -156,8 +156,8 @@ public class ManagementWebSecurityAutoConfigurationTests {
this.context.refresh();
// Just the management endpoints (one filter) and ignores now plus the backup
// filter on app endpoints
assertEquals(6, this.context.getBean(FilterChainProxy.class).getFilterChains()
.size());
assertEquals(6,
this.context.getBean(FilterChainProxy.class).getFilterChains().size());
}
@Test
@ -193,16 +193,14 @@ public class ManagementWebSecurityAutoConfigurationTests {
public void realmSameForManagement() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context
.register(AuthenticationConfig.class, SecurityAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class,
JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
WebMvcAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.register(AuthenticationConfig.class, SecurityAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class,
JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
WebMvcAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
Filter filter = this.context.getBean("springSecurityFilterChain", Filter.class);

View File

@ -88,8 +88,8 @@ public class MetricExportAutoConfigurationTests {
assertNotNull(gaugeService);
gaugeService.submit("foo", 2.7);
MetricExporters exporters = this.context.getBean(MetricExporters.class);
MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters().get(
"writer");
MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
.get("writer");
exporter.setIgnoreTimestamps(true);
exporter.export();
MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
@ -102,8 +102,8 @@ public class MetricExportAutoConfigurationTests {
MetricEndpointConfiguration.class, MetricExportAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
MetricExporters exporters = this.context.getBean(MetricExporters.class);
MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters().get(
"writer");
MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
.get("writer");
exporter.setIgnoreTimestamps(true);
exporter.export();
MetricsEndpointMetricReader reader = this.context.getBean("endpointReader",

View File

@ -65,8 +65,8 @@ public class MetricRepositoryAutoConfigurationTests {
assertNotNull(this.context.getBean(BufferCounterService.class));
assertNotNull(this.context.getBean(PrefixMetricReader.class));
gaugeService.submit("foo", 2.7);
assertEquals(2.7, this.context.getBean(MetricReader.class).findOne("gauge.foo")
.getValue());
assertEquals(2.7,
this.context.getBean(MetricReader.class).findOne("gauge.foo").getValue());
}
@Test

View File

@ -94,8 +94,8 @@ public class PublicMetricsAutoConfigurationTests {
@Test
public void metricReaderPublicMetrics() throws Exception {
load();
assertEquals(1, this.context.getBeansOfType(MetricReaderPublicMetrics.class)
.size());
assertEquals(1,
this.context.getBeansOfType(MetricReaderPublicMetrics.class).size());
}
@Test
@ -105,8 +105,8 @@ public class PublicMetricsAutoConfigurationTests {
PublicMetricsAutoConfiguration.class);
RichGaugeReader richGaugeReader = context.getBean(RichGaugeReader.class);
assertNotNull(richGaugeReader);
given(richGaugeReader.findAll()).willReturn(
Collections.singletonList(new RichGauge("bar", 3.7d)));
given(richGaugeReader.findAll())
.willReturn(Collections.singletonList(new RichGauge("bar", 3.7d)));
RichGaugeReaderPublicMetrics publicMetrics = context
.getBean(RichGaugeReaderPublicMetrics.class);
assertNotNull(publicMetrics);
@ -125,7 +125,8 @@ public class PublicMetricsAutoConfigurationTests {
@Test
public void noDataSource() {
load();
assertEquals(0, this.context.getBeansOfType(DataSourcePublicMetrics.class).size());
assertEquals(0,
this.context.getBeansOfType(DataSourcePublicMetrics.class).size());
}
@Test
@ -145,12 +146,12 @@ public class PublicMetricsAutoConfigurationTests {
"datasource.commonsDbcp.active", "datasource.commonsDbcp.usage");
// Hikari won't work unless a first connection has been retrieved
JdbcTemplate jdbcTemplate = new JdbcTemplate(this.context.getBean("hikariDS",
DataSource.class));
JdbcTemplate jdbcTemplate = new JdbcTemplate(
this.context.getBean("hikariDS", DataSource.class));
jdbcTemplate.execute(new ConnectionCallback<Void>() {
@Override
public Void doInConnection(Connection connection) throws SQLException,
DataAccessException {
public Void doInConnection(Connection connection)
throws SQLException, DataAccessException {
return null;
}
});

View File

@ -80,7 +80,8 @@ public class ServerContextPathHypermediaIntegrationTests {
"http://localhost:" + this.port + "/spring/actuator/", HttpMethod.GET,
new HttpEntity<Void>(null, headers), String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("<title"));
assertTrue("Wrong body: " + entity.getBody(),
entity.getBody().contains("<title"));
}
@Test

View File

@ -82,7 +82,8 @@ public class ServerPortHypermediaIntegrationTests {
"http://localhost:" + this.port + "/actuator/", HttpMethod.GET,
new HttpEntity<Void>(null, headers), String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertTrue("Wrong body: " + entity.getBody(), entity.getBody().contains("<title"));
assertTrue("Wrong body: " + entity.getBody(),
entity.getBody().contains("<title"));
}
@MinimalActuatorHypermediaApplication

View File

@ -59,7 +59,9 @@ public class SpringApplicationHierarchyTests {
@EnableAutoConfiguration(exclude = { ElasticsearchDataAutoConfiguration.class,
ElasticsearchRepositoriesAutoConfiguration.class,
CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class }, excludeName = { "org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
CassandraAutoConfiguration.class,
CassandraDataAutoConfiguration.class }, excludeName = {
"org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
public static class Child {
}
@ -67,7 +69,9 @@ public class SpringApplicationHierarchyTests {
EndpointMBeanExportAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class,
ElasticsearchRepositoriesAutoConfiguration.class,
CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class }, excludeName = { "org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
CassandraAutoConfiguration.class,
CassandraDataAutoConfiguration.class }, excludeName = {
"org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
public static class Parent {
}

View File

@ -83,8 +83,7 @@ public class VanillaHypermediaIntegrationTests {
@Test
public void trace() throws Exception {
this.mockMvc
.perform(get("/trace").accept(MediaType.APPLICATION_JSON))
this.mockMvc.perform(get("/trace").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$._links.self.href").value("http://localhost/trace"))
.andExpect(jsonPath("$.content").isArray());
@ -116,12 +115,9 @@ public class VanillaHypermediaIntegrationTests {
for (MvcEndpoint endpoint : this.mvcEndpoints.getEndpoints()) {
String path = endpoint.getPath();
path = path.length() > 0 ? path : "/";
this.mockMvc
.perform(get(path).accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(
jsonPath("$._links.self.href").value(
"http://localhost" + endpoint.getPath()));
this.mockMvc.perform(get(path).accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andExpect(jsonPath("$._links.self.href")
.value("http://localhost" + endpoint.getPath()));
}
}

View File

@ -96,18 +96,14 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
System.setProperty("foo.mycredentials.uri", "123456");
EnvironmentEndpoint report = getEndpointBean();
Map<String, Object> env = report.invoke();
assertEquals("******",
((Map<String, Object>) env.get("systemProperties"))
.get("my.services.amqp-free.credentials.uri"));
assertEquals("******",
((Map<String, Object>) env.get("systemProperties"))
.get("credentials.http_api_uri"));
assertEquals("******",
((Map<String, Object>) env.get("systemProperties"))
.get("my.services.cleardb-free.credentials"));
assertEquals("******",
((Map<String, Object>) env.get("systemProperties"))
.get("foo.mycredentials.uri"));
assertEquals("******", ((Map<String, Object>) env.get("systemProperties"))
.get("my.services.amqp-free.credentials.uri"));
assertEquals("******", ((Map<String, Object>) env.get("systemProperties"))
.get("credentials.http_api_uri"));
assertEquals("******", ((Map<String, Object>) env.get("systemProperties"))
.get("my.services.cleardb-free.credentials"));
assertEquals("******", ((Map<String, Object>) env.get("systemProperties"))
.get("foo.mycredentials.uri"));
}

View File

@ -72,12 +72,12 @@ public class EndpointMBeanExporterTests {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
MBeanInfo mbeanInfo = mbeanExporter.getServer().getMBeanInfo(
getObjectName("endpoint1", this.context));
MBeanInfo mbeanInfo = mbeanExporter.getServer()
.getMBeanInfo(getObjectName("endpoint1", this.context));
assertNotNull(mbeanInfo);
assertEquals(3, mbeanInfo.getOperations().length);
assertEquals(3, mbeanInfo.getAttributes().length);
@ -90,12 +90,12 @@ public class EndpointMBeanExporterTests {
new RootBeanDefinition(EndpointMBeanExporter.class));
MutablePropertyValues mvp = new MutablePropertyValues();
mvp.add("enabled", Boolean.FALSE);
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class, null, mvp));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class, null, mvp));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertFalse(mbeanExporter.getServer().isRegistered(
getObjectName("endpoint1", this.context)));
assertFalse(mbeanExporter.getServer()
.isRegistered(getObjectName("endpoint1", this.context)));
}
@Test
@ -105,12 +105,12 @@ public class EndpointMBeanExporterTests {
new RootBeanDefinition(EndpointMBeanExporter.class));
MutablePropertyValues mvp = new MutablePropertyValues();
mvp.add("enabled", Boolean.TRUE);
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class, null, mvp));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class, null, mvp));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertTrue(mbeanExporter.getServer().isRegistered(
getObjectName("endpoint1", this.context)));
assertTrue(mbeanExporter.getServer()
.isRegistered(getObjectName("endpoint1", this.context)));
}
@Test
@ -118,28 +118,27 @@ public class EndpointMBeanExporterTests {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class));
this.context.registerBeanDefinition("endpoint2", new RootBeanDefinition(
TestEndpoint.class));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class));
this.context.registerBeanDefinition("endpoint2",
new RootBeanDefinition(TestEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertNotNull(mbeanExporter.getServer().getMBeanInfo(
getObjectName("endpoint1", this.context)));
assertNotNull(mbeanExporter.getServer().getMBeanInfo(
getObjectName("endpoint2", this.context)));
assertNotNull(mbeanExporter.getServer()
.getMBeanInfo(getObjectName("endpoint1", this.context)));
assertNotNull(mbeanExporter.getServer()
.getMBeanInfo(getObjectName("endpoint2", this.context)));
}
@Test
public void testRegistrationWithDifferentDomain() throws Exception {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition(
"endpointMbeanExporter",
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class, null,
new MutablePropertyValues(Collections.singletonMap("domain",
"test-domain"))));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class));
new MutablePropertyValues(
Collections.singletonMap("domain", "test-domain"))));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertNotNull(mbeanExporter.getServer().getMBeanInfo(
@ -155,8 +154,8 @@ public class EndpointMBeanExporterTests {
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class, null,
new MutablePropertyValues(properties)));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertNotNull(mbeanExporter.getServer().getMBeanInfo(
@ -177,14 +176,14 @@ public class EndpointMBeanExporterTests {
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class, null,
new MutablePropertyValues(properties)));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertNotNull(mbeanExporter.getServer().getMBeanInfo(
ObjectNameManager.getInstance(getObjectName("test-domain", "endpoint1",
true, this.context).toString()
+ ",key1=value1,key2=value2")));
assertNotNull(mbeanExporter.getServer()
.getMBeanInfo(ObjectNameManager.getInstance(
getObjectName("test-domain", "endpoint1", true, this.context)
.toString() + ",key1=value1,key2=value2")));
}
@Test
@ -192,15 +191,15 @@ public class EndpointMBeanExporterTests {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
TestEndpoint.class));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(TestEndpoint.class));
GenericApplicationContext parent = new GenericApplicationContext();
this.context.setParent(parent);
parent.refresh();
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertNotNull(mbeanExporter.getServer().getMBeanInfo(
getObjectName("endpoint1", this.context)));
assertNotNull(mbeanExporter.getServer()
.getMBeanInfo(getObjectName("endpoint1", this.context)));
parent.close();
}
@ -210,8 +209,8 @@ public class EndpointMBeanExporterTests {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
JsonConversionEndpoint.class));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(JsonConversionEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
Object response = mbeanExporter.getServer().invoke(
@ -228,11 +227,11 @@ public class EndpointMBeanExporterTests {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
constructorArgs.addIndexedArgumentValue(0, objectMapper);
this.context
.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(
EndpointMBeanExporter.class, constructorArgs, null));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(
JsonConversionEndpoint.class));
this.context.registerBeanDefinition("endpointMbeanExporter",
new RootBeanDefinition(EndpointMBeanExporter.class, constructorArgs,
null));
this.context.registerBeanDefinition("endpoint1",
new RootBeanDefinition(JsonConversionEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
Object response = mbeanExporter.getServer().invoke(
@ -249,16 +248,14 @@ public class EndpointMBeanExporterTests {
private ObjectName getObjectName(String domain, String beanKey,
boolean includeIdentity, ApplicationContext applicationContext)
throws MalformedObjectNameException {
throws MalformedObjectNameException {
if (includeIdentity) {
return ObjectNameManager
.getInstance(String.format("%s:type=Endpoint,name=%s,identity=%s",
domain, beanKey, ObjectUtils
.getIdentityHexString(applicationContext
.getBean(beanKey))));
return ObjectNameManager.getInstance(String.format(
"%s:type=Endpoint,name=%s,identity=%s", domain, beanKey, ObjectUtils
.getIdentityHexString(applicationContext.getBean(beanKey))));
}
return ObjectNameManager.getInstance(String.format("%s:type=Endpoint,name=%s",
domain, beanKey));
return ObjectNameManager
.getInstance(String.format("%s:type=Endpoint,name=%s", domain, beanKey));
}
public static class TestEndpoint extends AbstractEndpoint<String> {
@ -274,8 +271,8 @@ public class EndpointMBeanExporterTests {
}
public static class JsonConversionEndpoint extends
AbstractEndpoint<Map<String, Object>> {
public static class JsonConversionEndpoint
extends AbstractEndpoint<Map<String, Object>> {
public JsonConversionEndpoint() {
super("json-conversion");

View File

@ -65,8 +65,8 @@ public class EnvironmentMvcEndpointTests {
public void setUp() {
this.context.getBean(EnvironmentEndpoint.class).setEnabled(true);
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
EnvironmentTestUtils.addEnvironment(
(ConfigurableApplicationContext) this.context, "foo:bar", "fool:baz");
EnvironmentTestUtils.addEnvironment((ConfigurableApplicationContext) this.context,
"foo:bar", "fool:baz");
}
@Test

View File

@ -98,10 +98,10 @@ public class HealthMvcEndpointTests {
@Test
@SuppressWarnings("unchecked")
public void customMapping() {
given(this.endpoint.invoke()).willReturn(
new Health.Builder().status("OK").build());
this.mvc.setStatusMapping(Collections.singletonMap("OK",
HttpStatus.INTERNAL_SERVER_ERROR));
given(this.endpoint.invoke())
.willReturn(new Health.Builder().status("OK").build());
this.mvc.setStatusMapping(
Collections.singletonMap("OK", HttpStatus.INTERNAL_SERVER_ERROR));
Object result = this.mvc.invoke(null);
assertTrue(result instanceof ResponseEntity);
ResponseEntity<Health> response = (ResponseEntity<Health>) result;
@ -112,8 +112,8 @@ public class HealthMvcEndpointTests {
@Test
@SuppressWarnings("unchecked")
public void customMappingWithRelaxedName() {
given(this.endpoint.invoke()).willReturn(
new Health.Builder().outOfService().build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().outOfService().build());
this.mvc.setStatusMapping(Collections.singletonMap("out-of-service",
HttpStatus.INTERNAL_SERVER_ERROR));
Object result = this.mvc.invoke(null);
@ -125,8 +125,8 @@ public class HealthMvcEndpointTests {
@Test
public void secureEvenWhenNotSensitive() {
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.isSensitive()).willReturn(false);
Object result = this.mvc.invoke(this.admin);
assertTrue(result instanceof Health);
@ -136,8 +136,8 @@ public class HealthMvcEndpointTests {
@Test
public void secureNonAdmin() {
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
Object result = this.mvc.invoke(this.user);
assertTrue(result instanceof Health);
assertTrue(((Health) result).getStatus() == Status.UP);
@ -148,8 +148,8 @@ public class HealthMvcEndpointTests {
public void healthIsCached() {
given(this.endpoint.getTimeToLive()).willReturn(10000L);
given(this.endpoint.isSensitive()).willReturn(true);
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
Object result = this.mvc.invoke(this.admin);
assertTrue(result instanceof Health);
Health health = (Health) result;
@ -170,8 +170,8 @@ public class HealthMvcEndpointTests {
public void unsecureAnonymousAccessUnrestricted() {
this.mvc = new HealthMvcEndpoint(this.endpoint, false);
this.mvc.setEnvironment(this.environment);
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
Object result = this.mvc.invoke(null);
assertTrue(result instanceof Health);
assertTrue(((Health) result).getStatus() == Status.UP);
@ -181,8 +181,8 @@ public class HealthMvcEndpointTests {
@Test
public void unsensitiveAnonymousAccessRestricted() {
this.environment.getPropertySources().addLast(NON_SENSITIVE);
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
Object result = this.mvc.invoke(null);
assertTrue(result instanceof Health);
assertTrue(((Health) result).getStatus() == Status.UP);
@ -194,8 +194,8 @@ public class HealthMvcEndpointTests {
this.mvc = new HealthMvcEndpoint(this.endpoint, false);
this.mvc.setEnvironment(this.environment);
this.environment.getPropertySources().addLast(NON_SENSITIVE);
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
Object result = this.mvc.invoke(null);
assertTrue(result instanceof Health);
assertTrue(((Health) result).getStatus() == Status.UP);
@ -205,8 +205,8 @@ public class HealthMvcEndpointTests {
@Test
public void noCachingWhenTimeToLiveIsZero() {
given(this.endpoint.getTimeToLive()).willReturn(0L);
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
Object result = this.mvc.invoke(null);
assertTrue(result instanceof Health);
assertTrue(((Health) result).getStatus() == Status.UP);
@ -221,8 +221,8 @@ public class HealthMvcEndpointTests {
public void newValueIsReturnedOnceTtlExpires() throws InterruptedException {
given(this.endpoint.getTimeToLive()).willReturn(50L);
given(this.endpoint.isSensitive()).willReturn(false);
given(this.endpoint.invoke()).willReturn(
new Health.Builder().up().withDetail("foo", "bar").build());
given(this.endpoint.invoke())
.willReturn(new Health.Builder().up().withDetail("foo", "bar").build());
Object result = this.mvc.invoke(null);
assertTrue(result instanceof Health);
assertTrue(((Health) result).getStatus() == Status.UP);

View File

@ -61,20 +61,21 @@ public class MvcEndpointCorsIntegrationTests {
@Test
public void corsIsDisabledByDefault() throws Exception {
createMockMvc().perform(
options("/beans").header("Origin", "foo.example.com").header(
HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")).andExpect(
header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
createMockMvc()
.perform(options("/beans").header("Origin", "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"))
.andExpect(
header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
}
@Test
public void settingAllowedOriginsEnablesCors() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.cors.allowed-origins:foo.example.com");
createMockMvc().perform(
options("/beans").header("Origin", "bar.example.com").header(
HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")).andExpect(
status().isForbidden());
createMockMvc()
.perform(options("/beans").header("Origin", "bar.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"))
.andExpect(status().isForbidden());
performAcceptedCorsRequest();
}
@ -82,8 +83,8 @@ public class MvcEndpointCorsIntegrationTests {
public void maxAgeDefaultsTo30Minutes() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.cors.allowed-origins:foo.example.com");
performAcceptedCorsRequest().andExpect(
header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800"));
performAcceptedCorsRequest()
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800"));
}
@Test
@ -91,16 +92,16 @@ public class MvcEndpointCorsIntegrationTests {
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.cors.allowed-origins:foo.example.com",
"endpoints.cors.max-age: 2400");
performAcceptedCorsRequest().andExpect(
header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "2400"));
performAcceptedCorsRequest()
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "2400"));
}
@Test
public void requestsWithDisallowedHeadersAreRejected() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.cors.allowed-origins:foo.example.com");
createMockMvc().perform(
options("/beans").header("Origin", "foo.example.com")
createMockMvc()
.perform(options("/beans").header("Origin", "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Alpha"))
.andExpect(status().isForbidden());
@ -112,25 +113,21 @@ public class MvcEndpointCorsIntegrationTests {
"endpoints.cors.allowed-origins:foo.example.com",
"endpoints.cors.allowed-headers:Alpha,Bravo");
createMockMvc()
.perform(
options("/beans")
.header("Origin", "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS,
"Alpha"))
.andExpect(status().isOk())
.andExpect(
header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Alpha"));
.perform(options("/beans").header("Origin", "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Alpha"))
.andExpect(status().isOk()).andExpect(header()
.string(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Alpha"));
}
@Test
public void requestsWithDisallowedMethodsAreRejected() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.cors.allowed-origins:foo.example.com");
createMockMvc().perform(
options("/health").header(HttpHeaders.ORIGIN, "foo.example.com").header(
HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD")).andExpect(
status().isForbidden());
createMockMvc()
.perform(options("/health").header(HttpHeaders.ORIGIN, "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD"))
.andExpect(status().isForbidden());
}
@Test
@ -139,14 +136,10 @@ public class MvcEndpointCorsIntegrationTests {
"endpoints.cors.allowed-origins:foo.example.com",
"endpoints.cors.allowed-methods:GET,HEAD");
createMockMvc()
.perform(
options("/health")
.header(HttpHeaders.ORIGIN, "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD"))
.andExpect(status().isOk())
.andExpect(
header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS,
"GET,HEAD"));
.perform(options("/health").header(HttpHeaders.ORIGIN, "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "HEAD"))
.andExpect(status().isOk()).andExpect(header()
.string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,HEAD"));
}
@Test
@ -171,10 +164,10 @@ public class MvcEndpointCorsIntegrationTests {
public void jolokiaEndpointUsesGlobalCorsConfiguration() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.cors.allowed-origins:foo.example.com");
createMockMvc().perform(
options("/jolokia").header("Origin", "bar.example.com").header(
HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET")).andExpect(
status().isForbidden());
createMockMvc()
.perform(options("/jolokia").header("Origin", "bar.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"))
.andExpect(status().isForbidden());
performAcceptedCorsRequest("/jolokia");
}
@ -189,12 +182,11 @@ public class MvcEndpointCorsIntegrationTests {
private ResultActions performAcceptedCorsRequest(String url) throws Exception {
return createMockMvc()
.perform(
options(url).header(HttpHeaders.ORIGIN, "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"))
.andExpect(
header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN,
"foo.example.com")).andExpect(status().isOk());
.perform(options(url).header(HttpHeaders.ORIGIN, "foo.example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"))
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN,
"foo.example.com"))
.andExpect(status().isOk());
}
}

View File

@ -182,8 +182,8 @@ public class MvcEndpointIntegrationTests {
EnvironmentTestUtils.addEnvironment(this.context,
"spring.jackson.serialization.indent-output:true");
MockMvc mockMvc = createMockMvc();
mockMvc.perform(get("/beans")).andExpect(
content().string(startsWith("{" + LINE_SEPARATOR)));
mockMvc.perform(get("/beans"))
.andExpect(content().string(startsWith("{" + LINE_SEPARATOR)));
}
private MockMvc createMockMvc() {
@ -205,8 +205,8 @@ public class MvcEndpointIntegrationTests {
}
@ImportAutoConfiguration({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class })
static class DefaultConfiguration {
@ -224,8 +224,8 @@ public class MvcEndpointIntegrationTests {
@ImportAutoConfiguration({ HypermediaAutoConfiguration.class,
RepositoryRestMvcAutoConfiguration.class, JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class })
static class SpringDataRestConfiguration {

View File

@ -65,15 +65,15 @@ public class MvcEndpointsTests {
@Test
public void changesPath() throws Exception {
EnvironmentTestUtils
.addEnvironment(this.context, "endpoints.test.path=/foo/bar/");
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.test.path=/foo/bar/");
this.context.getDefaultListableBeanFactory().registerSingleton("endpoint",
new TestEndpoint());
this.endpoints.setApplicationContext(this.context);
this.endpoints.afterPropertiesSet();
assertEquals(1, this.endpoints.getEndpoints().size());
assertEquals("/foo/bar", this.endpoints.getEndpoints().iterator().next()
.getPath());
assertEquals("/foo/bar",
this.endpoints.getEndpoints().iterator().next().getPath());
}
protected static class TestEndpoint extends AbstractEndpoint<String> {

View File

@ -120,8 +120,8 @@ public class ElasticsearchHealthIndicatorTests {
public void healthDetails() {
PlainActionFuture<ClusterHealthResponse> responseFuture = new PlainActionFuture<ClusterHealthResponse>();
responseFuture.onResponse(new StubClusterHealthResponse());
given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(
responseFuture);
given(this.cluster.health(any(ClusterHealthRequest.class)))
.willReturn(responseFuture);
Health health = this.indicator.health();
assertThat(health.getStatus(), is(Status.UP));
Map<String, Object> details = health.getDetails();
@ -139,26 +139,26 @@ public class ElasticsearchHealthIndicatorTests {
public void redResponseMapsToDown() {
PlainActionFuture<ClusterHealthResponse> responseFuture = new PlainActionFuture<ClusterHealthResponse>();
responseFuture.onResponse(new StubClusterHealthResponse(ClusterHealthStatus.RED));
given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(
responseFuture);
given(this.cluster.health(any(ClusterHealthRequest.class)))
.willReturn(responseFuture);
assertThat(this.indicator.health().getStatus(), is(Status.DOWN));
}
@Test
public void yellowResponseMapsToUp() {
PlainActionFuture<ClusterHealthResponse> responseFuture = new PlainActionFuture<ClusterHealthResponse>();
responseFuture.onResponse(new StubClusterHealthResponse(
ClusterHealthStatus.YELLOW));
given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(
responseFuture);
responseFuture
.onResponse(new StubClusterHealthResponse(ClusterHealthStatus.YELLOW));
given(this.cluster.health(any(ClusterHealthRequest.class)))
.willReturn(responseFuture);
assertThat(this.indicator.health().getStatus(), is(Status.UP));
}
@Test
public void responseTimeout() {
PlainActionFuture<ClusterHealthResponse> responseFuture = new PlainActionFuture<ClusterHealthResponse>();
given(this.cluster.health(any(ClusterHealthRequest.class))).willReturn(
responseFuture);
given(this.cluster.health(any(ClusterHealthRequest.class)))
.willReturn(responseFuture);
Health health = this.indicator.health();
assertThat(health.getStatus(), is(Status.DOWN));
assertThat((String) health.getDetails().get("error"),
@ -179,9 +179,10 @@ public class ElasticsearchHealthIndicatorTests {
}
private StubClusterHealthResponse(ClusterHealthStatus status) {
super("test-cluster", new String[0], new ClusterState(null, 0, null,
RoutingTable.builder().build(), DiscoveryNodes.builder().build(),
ClusterBlocks.builder().build(), null));
super("test-cluster", new String[0],
new ClusterState(null, 0, null, RoutingTable.builder().build(),
DiscoveryNodes.builder().build(),
ClusterBlocks.builder().build(), null));
this.status = status;
}
@ -227,8 +228,8 @@ public class ElasticsearchHealthIndicatorTests {
}
private static class TestActionFuture extends
PlainActionFuture<ClusterHealthResponse> {
private static class TestActionFuture
extends PlainActionFuture<ClusterHealthResponse> {
private long getTimeout = -1L;

View File

@ -54,8 +54,8 @@ public class JmsHealthIndicatorTests {
@Test
public void jmsBrokerIsDown() throws JMSException {
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
given(connectionFactory.createConnection()).willThrow(
new JMSException("test", "123"));
given(connectionFactory.createConnection())
.willThrow(new JMSException("test", "123"));
JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory);
Health health = indicator.health();
assertEquals(Status.DOWN, health.getStatus());
@ -65,8 +65,8 @@ public class JmsHealthIndicatorTests {
@Test
public void jmsBrokerCouldNotRetrieveProviderMetadata() throws JMSException {
ConnectionMetaData connectionMetaData = mock(ConnectionMetaData.class);
given(connectionMetaData.getJMSProviderName()).willThrow(
new JMSException("test", "123"));
given(connectionMetaData.getJMSProviderName())
.willThrow(new JMSException("test", "123"));
Connection connection = mock(Connection.class);
given(connection.getMetaData()).willReturn(connectionMetaData);
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);

View File

@ -32,7 +32,8 @@ public class BufferMetricReaderTests {
private GaugeBuffers gauges = new GaugeBuffers();
private BufferMetricReader reader = new BufferMetricReader(this.counters, this.gauges);
private BufferMetricReader reader = new BufferMetricReader(this.counters,
this.gauges);
@Test
public void countReflectsNumberOfMetrics() {

View File

@ -93,8 +93,8 @@ public class DefaultGaugeServiceSpeedTests {
public void run() {
for (int i = 0; i < number; i++) {
String name = sample[i % sample.length];
DefaultGaugeServiceSpeedTests.this.gaugeService.submit(name, count
+ i);
DefaultGaugeServiceSpeedTests.this.gaugeService.submit(name,
count + i);
}
}
};

View File

@ -121,7 +121,8 @@ public class DropwizardMetricServicesTests {
private DropwizardMetricServices writer;
public WriterThread(ThreadGroup group, int index, DropwizardMetricServices writer) {
public WriterThread(ThreadGroup group, int index,
DropwizardMetricServices writer) {
super(group, "Writer-" + index);
this.index = index;
this.writer = writer;

View File

@ -76,8 +76,8 @@ public class RedisMultiMetricRepositoryTests {
@After
public void clear() {
assertTrue(new StringRedisTemplate(this.redis.getConnectionFactory())
.opsForZSet().size("keys." + this.prefix) > 0);
assertTrue(new StringRedisTemplate(this.redis.getConnectionFactory()).opsForZSet()
.size("keys." + this.prefix) > 0);
this.repository.reset("foo");
this.repository.reset("bar");
assertNull(new StringRedisTemplate(this.redis.getConnectionFactory())
@ -92,23 +92,26 @@ public class RedisMultiMetricRepositoryTests {
Arrays.<Metric<?>>asList(new Metric<Number>("foo.bar", 12.3)));
this.repository.set("foo",
Arrays.<Metric<?>>asList(new Metric<Number>("foo.bar", 15.3)));
assertEquals(15.3, Iterables.collection(this.repository.findAll("foo"))
.iterator().next().getValue());
assertEquals(15.3, Iterables.collection(this.repository.findAll("foo")).iterator()
.next().getValue());
}
@Test
public void setAndGetMultiple() {
this.repository.set("foo", Arrays.<Metric<?>>asList(new Metric<Number>("foo.val",
12.3), new Metric<Number>("foo.bar", 11.3)));
this.repository.set("foo",
Arrays.<Metric<?>>asList(new Metric<Number>("foo.val", 12.3),
new Metric<Number>("foo.bar", 11.3)));
assertEquals(2, Iterables.collection(this.repository.findAll("foo")).size());
}
@Test
public void groups() {
this.repository.set("foo", Arrays.<Metric<?>>asList(new Metric<Number>("foo.val",
12.3), new Metric<Number>("foo.bar", 11.3)));
this.repository.set("bar", Arrays.<Metric<?>>asList(new Metric<Number>("bar.val",
12.3), new Metric<Number>("bar.foo", 11.3)));
this.repository.set("foo",
Arrays.<Metric<?>>asList(new Metric<Number>("foo.val", 12.3),
new Metric<Number>("foo.bar", 11.3)));
this.repository.set("bar",
Arrays.<Metric<?>>asList(new Metric<Number>("bar.val", 12.3),
new Metric<Number>("bar.foo", 11.3)));
Collection<String> groups = Iterables.collection(this.repository.groups());
assertEquals(2, groups.size());
assertTrue("Wrong groups: " + groups, groups.contains("foo"));
@ -116,10 +119,12 @@ public class RedisMultiMetricRepositoryTests {
@Test
public void count() {
this.repository.set("foo", Arrays.<Metric<?>>asList(new Metric<Number>("foo.val",
12.3), new Metric<Number>("foo.bar", 11.3)));
this.repository.set("bar", Arrays.<Metric<?>>asList(new Metric<Number>("bar.val",
12.3), new Metric<Number>("bar.foo", 11.3)));
this.repository.set("foo",
Arrays.<Metric<?>>asList(new Metric<Number>("foo.val", 12.3),
new Metric<Number>("foo.bar", 11.3)));
this.repository.set("bar",
Arrays.<Metric<?>>asList(new Metric<Number>("bar.val", 12.3),
new Metric<Number>("bar.foo", 11.3)));
assertEquals(2, this.repository.countGroups());
}

View File

@ -116,8 +116,9 @@ public class StatsdMetricWriterTests {
final DatagramPacket packet = new DatagramPacket(new byte[256],
256);
DummyStatsDServer.this.server.receive(packet);
DummyStatsDServer.this.messagesReceived.add(new String(packet
.getData(), Charset.forName("UTF-8")).trim());
DummyStatsDServer.this.messagesReceived.add(
new String(packet.getData(), Charset.forName("UTF-8"))
.trim());
}
catch (Exception e) {
// Ignore

View File

@ -75,7 +75,8 @@ public class ApplicationPidFileWriterTests {
File file = this.temporaryFolder.newFile();
ApplicationPidFileWriter listener = new ApplicationPidFileWriter(file);
listener.onApplicationEvent(EVENT);
assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString()));
assertThat(FileCopyUtils.copyToString(new FileReader(file)),
not(isEmptyString()));
}
@Test
@ -96,7 +97,8 @@ public class ApplicationPidFileWriterTests {
file.getAbsolutePath());
ApplicationPidFileWriter listener = new ApplicationPidFileWriter();
listener.onApplicationEvent(event);
assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString()));
assertThat(FileCopyUtils.copyToString(new FileReader(file)),
not(isEmptyString()));
}
@Test
@ -109,7 +111,8 @@ public class ApplicationPidFileWriterTests {
assertThat(FileCopyUtils.copyToString(new FileReader(file)), isEmptyString());
listener.setTriggerEventType(ApplicationEnvironmentPreparedEvent.class);
listener.onApplicationEvent(event);
assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString()));
assertThat(FileCopyUtils.copyToString(new FileReader(file)),
not(isEmptyString()));
}
@Test
@ -117,9 +120,10 @@ public class ApplicationPidFileWriterTests {
File file = this.temporaryFolder.newFile();
ApplicationPidFileWriter listener = new ApplicationPidFileWriter(file);
listener.setTriggerEventType(ApplicationStartedEvent.class);
listener.onApplicationEvent(new ApplicationStartedEvent(new SpringApplication(),
new String[] {}));
assertThat(FileCopyUtils.copyToString(new FileReader(file)), not(isEmptyString()));
listener.onApplicationEvent(
new ApplicationStartedEvent(new SpringApplication(), new String[] {}));
assertThat(FileCopyUtils.copyToString(new FileReader(file)),
not(isEmptyString()));
}
@Test
@ -161,9 +165,11 @@ public class ApplicationPidFileWriterTests {
new String[] {}, environment);
}
private SpringApplicationEvent createPreparedEvent(String propName, String propValue) {
private SpringApplicationEvent createPreparedEvent(String propName,
String propValue) {
ConfigurableEnvironment environment = createEnvironment(propName, propValue);
ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
ConfigurableApplicationContext context = mock(
ConfigurableApplicationContext.class);
given(context.getEnvironment()).willReturn(environment);
return new ApplicationPreparedEvent(new SpringApplication(), new String[] {},
context);

View File

@ -42,8 +42,8 @@ import org.springframework.util.StringUtils;
* @since 1.3.0
* @see BeanDefinition#setDependsOn(String[])
*/
public abstract class AbstractDependsOnBeanFactoryPostProcessor implements
BeanFactoryPostProcessor {
public abstract class AbstractDependsOnBeanFactoryPostProcessor
implements BeanFactoryPostProcessor {
private final Class<?> beanClass;
@ -74,9 +74,8 @@ public abstract class AbstractDependsOnBeanFactoryPostProcessor implements
Set<String> names = new HashSet<String>();
names.addAll(Arrays.asList(BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
beanFactory, this.beanClass, true, false)));
for (String factoryBeanName : BeanFactoryUtils
.beanNamesForTypeIncludingAncestors(beanFactory, this.factoryBeanClass,
true, false)) {
for (String factoryBeanName : BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
beanFactory, this.factoryBeanClass, true, false)) {
names.add(BeanFactoryUtils.transformedBeanName(factoryBeanName));
}
return names;

View File

@ -71,7 +71,8 @@ public class EnableAutoConfigurationImportSelector implements DeferredImportSele
public String[] selectImports(AnnotationMetadata metadata) {
try {
AnnotationAttributes attributes = getAttributes(metadata);
List<String> configurations = getCandidateConfigurations(metadata, attributes);
List<String> configurations = getCandidateConfigurations(metadata,
attributes);
configurations = removeDuplicates(configurations);
Set<String> exclusions = getExclusions(metadata, attributes);
configurations.removeAll(exclusions);
@ -93,8 +94,8 @@ public class EnableAutoConfigurationImportSelector implements DeferredImportSele
*/
protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) {
String name = getAnnotationClass().getName();
AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata
.getAnnotationAttributes(name, true));
AnnotationAttributes attributes = AnnotationAttributes
.fromMap(metadata.getAnnotationAttributes(name, true));
Assert.notNull(attributes,
"No auto-configuration attributes found. Is " + metadata.getClassName()
+ " annotated with " + ClassUtils.getShortName(name) + "?");

View File

@ -87,9 +87,8 @@ public class MessageSourceAutoConfiguration {
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
if (StringUtils.hasText(this.basename)) {
messageSource.setBasenames(StringUtils
.commaDelimitedListToStringArray(StringUtils
.trimAllWhitespace(this.basename)));
messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(
StringUtils.trimAllWhitespace(this.basename)));
}
if (this.encoding != null) {
messageSource.setDefaultEncoding(this.encoding.name());
@ -138,8 +137,8 @@ public class MessageSourceAutoConfiguration {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
String basename = context.getEnvironment().getProperty(
"spring.messages.basename", "messages");
String basename = context.getEnvironment()
.getProperty("spring.messages.basename", "messages");
ConditionOutcome outcome = cache.get(basename);
if (outcome == null) {
outcome = getMatchOutcomeForBasename(context, basename);
@ -150,8 +149,8 @@ public class MessageSourceAutoConfiguration {
private ConditionOutcome getMatchOutcomeForBasename(ConditionContext context,
String basename) {
for (String name : StringUtils.commaDelimitedListToStringArray(StringUtils
.trimAllWhitespace(basename))) {
for (String name : StringUtils.commaDelimitedListToStringArray(
StringUtils.trimAllWhitespace(basename))) {
for (Resource resource : getResources(context.getClassLoader(), name)) {
if (resource.exists()) {
return ConditionOutcome.match("Bundle found for "
@ -159,8 +158,8 @@ public class MessageSourceAutoConfiguration {
}
}
}
return ConditionOutcome.noMatch("No bundle found for "
+ "spring.messages.basename: " + basename);
return ConditionOutcome.noMatch(
"No bundle found for " + "spring.messages.basename: " + basename);
}
private Resource[] getResources(ClassLoader classLoader, String name) {
@ -179,10 +178,11 @@ public class MessageSourceAutoConfiguration {
* {@link PathMatchingResourcePatternResolver} that skips well known JARs that don't
* contain messages.properties.
*/
private static class SkipPatternPathMatchingResourcePatternResolver extends
PathMatchingResourcePatternResolver {
private static class SkipPatternPathMatchingResourcePatternResolver
extends PathMatchingResourcePatternResolver {
private static final ClassLoader ROOT_CLASSLOADER;
static {
ClassLoader classLoader = null;
try {
@ -223,7 +223,8 @@ public class MessageSourceAutoConfiguration {
protected Set<Resource> doFindAllClassPathResources(String path)
throws IOException {
Set<Resource> resources = super.doFindAllClassPathResources(path);
for (Iterator<Resource> iterator = resources.iterator(); iterator.hasNext();) {
for (Iterator<Resource> iterator = resources.iterator(); iterator
.hasNext();) {
Resource resource = iterator.next();
for (String skipped : SKIPPED) {
if (resource.getFilename().startsWith(skipped)) {

View File

@ -62,8 +62,8 @@ public class SpringApplicationAdminJmxAutoConfiguration {
@Bean
public SpringApplicationAdminMXBeanRegistrar springApplicationAdminRegistrar()
throws MalformedObjectNameException {
String jmxName = this.environment
.getProperty(JMX_NAME_PROPERTY, DEFAULT_JMX_NAME);
String jmxName = this.environment.getProperty(JMX_NAME_PROPERTY,
DEFAULT_JMX_NAME);
if (this.mbeanExporter != null) { // Make sure to not register that MBean twice
this.mbeanExporter.addExcludedBean(jmxName);
}

View File

@ -112,9 +112,9 @@ public class BatchAutoConfiguration {
@Bean
@ConditionalOnMissingBean(JobOperator.class)
public SimpleJobOperator jobOperator(JobExplorer jobExplorer,
JobLauncher jobLauncher, ListableJobLocator jobRegistry,
JobRepository jobRepository) throws Exception {
public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher,
ListableJobLocator jobRegistry, JobRepository jobRepository)
throws Exception {
SimpleJobOperator factory = new SimpleJobOperator();
factory.setJobExplorer(jobExplorer);
factory.setJobLauncher(jobLauncher);

View File

@ -87,8 +87,8 @@ public class CacheAutoConfiguration {
for (String name : beanFactory.getBeanNamesForType(CacheAspectSupport.class,
false, false)) {
BeanDefinition definition = beanFactory.getBeanDefinition(name);
definition.setDependsOn(append(definition.getDependsOn(),
VALIDATOR_BEAN_NAME));
definition.setDependsOn(
append(definition.getDependsOn(), VALIDATOR_BEAN_NAME));
}
}
@ -116,9 +116,10 @@ public class CacheAutoConfiguration {
@PostConstruct
public void checkHasCacheManager() {
Assert.notNull(this.cacheManager, "No cache manager could "
+ "be auto-configured, check your configuration (caching "
+ "type is '" + this.cacheProperties.getType() + "')");
Assert.notNull(this.cacheManager,
"No cache manager could "
+ "be auto-configured, check your configuration (caching "
+ "type is '" + this.cacheProperties.getType() + "')");
}
}

View File

@ -40,8 +40,8 @@ class CacheCondition extends SpringBootCondition {
if (!resolver.containsProperty("type")) {
return ConditionOutcome.match("Automatic cache type");
}
CacheType cacheType = CacheConfigurations.getType(((AnnotationMetadata) metadata)
.getClassName());
CacheType cacheType = CacheConfigurations
.getType(((AnnotationMetadata) metadata).getClassName());
String value = resolver.getProperty("type").replace("-", "_").toUpperCase();
if (value.equals(cacheType.name())) {
return ConditionOutcome.match("Cache type " + cacheType);

View File

@ -33,6 +33,7 @@ final class CacheConfigurations {
}
private static final Map<CacheType, Class<?>> MAPPINGS;
static {
Map<CacheType, Class<?>> mappings = new HashMap<CacheType, Class<?>>();
mappings.put(CacheType.GENERIC, GenericCacheConfiguration.class);
@ -59,8 +60,8 @@ final class CacheConfigurations {
return entry.getKey();
}
}
throw new IllegalStateException("Unknown configuration class "
+ configurationClassName);
throw new IllegalStateException(
"Unknown configuration class " + configurationClassName);
}
}

View File

@ -89,8 +89,8 @@ class JCacheCacheConfiguration {
}
private CacheManager createCacheManager() throws IOException {
CachingProvider cachingProvider = getCachingProvider(this.cacheProperties
.getJcache().getProvider());
CachingProvider cachingProvider = getCachingProvider(
this.cacheProperties.getJcache().getProvider());
Resource configLocation = this.cacheProperties
.resolveConfigLocation(this.cacheProperties.getJcache().getConfig());
if (configLocation != null) {
@ -112,8 +112,8 @@ class JCacheCacheConfiguration {
throws IOException {
Properties properties = new Properties();
// Hazelcast does not use the URI as a mean to specify a custom config.
properties.setProperty("hazelcast.config.location", configLocation.getURI()
.toString());
properties.setProperty("hazelcast.config.location",
configLocation.getURI().toString());
return properties;
}
@ -178,8 +178,8 @@ class JCacheCacheConfiguration {
}
providers.next();
if (providers.hasNext()) {
return ConditionOutcome.noMatch("Multiple default JSR-107 compliant "
+ "providers found");
return ConditionOutcome.noMatch(
"Multiple default JSR-107 compliant " + "providers found");
}
return ConditionOutcome.match("Default JSR-107 compliant provider found.");

View File

@ -42,8 +42,8 @@ import org.springframework.util.StringUtils;
*
* @author Phillip Webb
*/
abstract class AbstractNestedCondition extends SpringBootCondition implements
ConfigurationCondition {
abstract class AbstractNestedCondition extends SpringBootCondition
implements ConfigurationCondition {
private final ConfigurationPhase configurationPhase;

View File

@ -47,10 +47,11 @@ public abstract class AllNestedConditions extends AbstractNestedCondition {
@Override
protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) {
return new ConditionOutcome(memberOutcomes.getMatches().size() == memberOutcomes
.getAll().size(), "nested all match resulted in "
+ memberOutcomes.getMatches() + " matches and "
+ memberOutcomes.getNonMatches() + " non matches");
return new ConditionOutcome(
memberOutcomes.getMatches().size() == memberOutcomes.getAll().size(),
"nested all match resulted in " + memberOutcomes.getMatches()
+ " matches and " + memberOutcomes.getNonMatches()
+ " non matches");
}
}

View File

@ -84,19 +84,19 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
ConditionalOnBean.class);
List<String> matching = getMatchingBeans(context, spec);
if (matching.isEmpty()) {
return ConditionOutcome.noMatch("@ConditionalOnBean " + spec
+ " found no beans");
return ConditionOutcome
.noMatch("@ConditionalOnBean " + spec + " found no beans");
}
matchMessage.append("@ConditionalOnBean " + spec + " found the following "
+ matching);
matchMessage.append(
"@ConditionalOnBean " + spec + " found the following " + matching);
}
if (metadata.isAnnotated(ConditionalOnSingleCandidate.class.getName())) {
BeanSearchSpec spec = new SingleCandidateBeanSearchSpec(context, metadata,
ConditionalOnSingleCandidate.class);
List<String> matching = getMatchingBeans(context, spec);
if (matching.isEmpty()) {
return ConditionOutcome.noMatch("@ConditionalOnSingleCandidate " + spec
+ " found no beans");
return ConditionOutcome.noMatch(
"@ConditionalOnSingleCandidate " + spec + " found no beans");
}
else if (!hasSingleAutowireCandidate(context.getBeanFactory(), matching)) {
return ConditionOutcome.noMatch("@ConditionalOnSingleCandidate " + spec
@ -120,7 +120,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
return ConditionOutcome.match(matchMessage.toString());
}
private List<String> getMatchingBeans(ConditionContext context, BeanSearchSpec beans) {
private List<String> getMatchingBeans(ConditionContext context,
BeanSearchSpec beans) {
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
if (beans.getStrategy() == SearchStrategy.PARENTS) {
BeanFactory parent = beanFactory.getParentBeanFactory();
@ -163,7 +164,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
private Collection<String> getBeanNamesForType(ListableBeanFactory beanFactory,
String type, ClassLoader classLoader, boolean considerHierarchy)
throws LinkageError {
throws LinkageError {
try {
Set<String> result = new LinkedHashSet<String>();
collectBeanNamesForType(result, beanFactory,
@ -198,7 +199,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
.forName(type, classLoader);
result = beanFactory.getBeanNamesForAnnotation(typeClass);
if (considerHierarchy) {
if (beanFactory.getParentBeanFactory() instanceof ConfigurableListableBeanFactory) {
if (beanFactory
.getParentBeanFactory() instanceof ConfigurableListableBeanFactory) {
String[] parentResult = getBeanNamesForAnnotation(
(ConfigurableListableBeanFactory) beanFactory
.getParentBeanFactory(),
@ -223,7 +225,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
private boolean hasSingleAutowireCandidate(
ConfigurableListableBeanFactory beanFactory, List<String> beanNames) {
return (beanNames.size() == 1 || getPrimaryBeans(beanFactory, beanNames).size() == 1);
return (beanNames.size() == 1
|| getPrimaryBeans(beanFactory, beanNames).size() == 1);
}
private List<String> getPrimaryBeans(ConfigurableListableBeanFactory beanFactory,
@ -266,8 +269,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
if (this.types.isEmpty() && this.names.isEmpty()) {
addDeducedBeanType(context, metadata, this.types);
}
this.strategy = (SearchStrategy) metadata.getAnnotationAttributes(
annotationType.getName()).get("search");
this.strategy = (SearchStrategy) metadata
.getAnnotationAttributes(annotationType.getName()).get("search");
validate();
}
@ -324,8 +327,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
methodMetadata.getDeclaringClassName(), context.getClassLoader());
ReflectionUtils.doWithMethods(configClass, new MethodCallback() {
@Override
public void doWith(Method method) throws IllegalArgumentException,
IllegalAccessException {
public void doWith(Method method)
throws IllegalArgumentException, IllegalAccessException {
if (methodMetadata.getMethodName().equals(method.getName())) {
beanTypes.add(method.getReturnType().getName());
}
@ -335,10 +338,9 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
catch (Throwable ex) {
// swallow exception and continue
if (logger.isDebugEnabled()) {
logger.debug(
"Unable to deduce bean type for "
+ methodMetadata.getDeclaringClassName() + "."
+ methodMetadata.getMethodName(), ex);
logger.debug("Unable to deduce bean type for "
+ methodMetadata.getDeclaringClassName() + "."
+ methodMetadata.getMethodName(), ex);
}
}
}

View File

@ -50,8 +50,10 @@ class OnResourceCondition extends SpringBootCondition {
Assert.isTrue(locations.size() > 0,
"@ConditionalOnResource annotations must specify at least one resource location");
for (String location : locations) {
if (!loader.getResource(
context.getEnvironment().resolvePlaceholders(location)).exists()) {
if (!loader
.getResource(
context.getEnvironment().resolvePlaceholders(location))
.exists()) {
return ConditionOutcome.noMatch("resource not found: " + location);
}
}

View File

@ -78,12 +78,12 @@ public abstract class ResourceCondition extends SpringBootCondition {
for (String location : this.resourceLocations) {
Resource resource = context.getResourceLoader().getResource(location);
if (resource != null && resource.exists()) {
return ConditionOutcome.match("Found " + this.name + " config in "
+ resource);
return ConditionOutcome
.match("Found " + this.name + " config in " + resource);
}
}
return ConditionOutcome.noMatch("No specific " + this.name
+ " configuration found");
return ConditionOutcome
.noMatch("No specific " + this.name + " configuration found");
}
}

View File

@ -31,8 +31,8 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* @author Eddú Meléndez
* @since 1.3.0
*/
class CassandraRepositoriesAutoConfigureRegistrar extends
AbstractRepositoryConfigurationSourceSupport {
class CassandraRepositoriesAutoConfigureRegistrar
extends AbstractRepositoryConfigurationSourceSupport {
@Override
protected Class<? extends Annotation> getAnnotation() {

View File

@ -56,6 +56,7 @@ import org.springframework.util.StringUtils;
public class ElasticsearchAutoConfiguration implements DisposableBean {
private static final Map<String, String> DEFAULTS;
static {
Map<String, String> defaults = new LinkedHashMap<String, String>();
defaults.put("http.enabled", String.valueOf(false));

View File

@ -34,8 +34,8 @@ import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
* @since 1.1.0
* @see BeanDefinition#setDependsOn(String[])
*/
public class EntityManagerFactoryDependsOnPostProcessor extends
AbstractDependsOnBeanFactoryPostProcessor {
public class EntityManagerFactoryDependsOnPostProcessor
extends AbstractDependsOnBeanFactoryPostProcessor {
public EntityManagerFactoryDependsOnPostProcessor(String... dependsOn) {
super(EntityManagerFactory.class, AbstractEntityManagerFactoryBean.class,

View File

@ -34,8 +34,8 @@ import com.mongodb.MongoClient;
* @since 1.3.0
*/
@Order(Ordered.LOWEST_PRECEDENCE)
public class MongoClientDependsOnBeanFactoryPostProcessor extends
AbstractDependsOnBeanFactoryPostProcessor {
public class MongoClientDependsOnBeanFactoryPostProcessor
extends AbstractDependsOnBeanFactoryPostProcessor {
public MongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) {
super(MongoClient.class, MongoClientFactoryBean.class, dependsOn);

View File

@ -142,8 +142,8 @@ public class MongoDataAutoConfiguration implements BeanClassLoaderAware {
context.setInitialEntitySet(getInitialEntitySet(beanFactory));
Class<?> strategyClass = this.properties.getFieldNamingStrategy();
if (strategyClass != null) {
context.setFieldNamingStrategy((FieldNamingStrategy) BeanUtils
.instantiate(strategyClass));
context.setFieldNamingStrategy(
(FieldNamingStrategy) BeanUtils.instantiate(strategyClass));
}
return context;
}

View File

@ -114,8 +114,8 @@ public class RedisAutoConfiguration {
sentinels.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
}
catch (RuntimeException ex) {
throw new IllegalStateException("Invalid redis sentinel "
+ "property '" + node + "'", ex);
throw new IllegalStateException(
"Invalid redis sentinel " + "property '" + node + "'", ex);
}
}
return sentinels;
@ -128,8 +128,8 @@ public class RedisAutoConfiguration {
*/
@Configuration
@ConditionalOnMissingClass("org.apache.commons.pool2.impl.GenericObjectPool")
protected static class RedisConnectionConfiguration extends
AbstractRedisConfiguration {
protected static class RedisConnectionConfiguration
extends AbstractRedisConfiguration {
@Bean
@ConditionalOnMissingBean(RedisConnectionFactory.class)
@ -145,8 +145,8 @@ public class RedisAutoConfiguration {
*/
@Configuration
@ConditionalOnClass(GenericObjectPool.class)
protected static class RedisPooledConnectionConfiguration extends
AbstractRedisConfiguration {
protected static class RedisPooledConnectionConfiguration
extends AbstractRedisConfiguration {
@Bean
@ConditionalOnMissingBean(RedisConnectionFactory.class)
@ -184,7 +184,7 @@ public class RedisAutoConfiguration {
@ConditionalOnMissingBean(name = "redisTemplate")
public RedisTemplate<Object, Object> redisTemplate(
RedisConnectionFactory redisConnectionFactory)
throws UnknownHostException {
throws UnknownHostException {
RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>();
template.setConnectionFactory(redisConnectionFactory);
return template;
@ -194,7 +194,7 @@ public class RedisAutoConfiguration {
@ConditionalOnMissingBean(StringRedisTemplate.class)
public StringRedisTemplate stringRedisTemplate(
RedisConnectionFactory redisConnectionFactory)
throws UnknownHostException {
throws UnknownHostException {
StringRedisTemplate template = new StringRedisTemplate();
template.setConnectionFactory(redisConnectionFactory);
return template;

View File

@ -130,8 +130,8 @@ public class FlywayAutoConfiguration {
@Configuration
@ConditionalOnClass(LocalContainerEntityManagerFactoryBean.class)
@ConditionalOnBean(AbstractEntityManagerFactoryBean.class)
protected static class FlywayInitializerJpaDependencyConfiguration extends
EntityManagerFactoryDependsOnPostProcessor {
protected static class FlywayInitializerJpaDependencyConfiguration
extends EntityManagerFactoryDependsOnPostProcessor {
public FlywayInitializerJpaDependencyConfiguration() {
super("flywayInitializer");

View File

@ -72,8 +72,8 @@ public class H2ConsoleAutoConfiguration {
}
@Order(SecurityProperties.BASIC_AUTH_ORDER - 10)
private static class H2ConsoleSecurityConfigurer extends
WebSecurityConfigurerAdapter {
private static class H2ConsoleSecurityConfigurer
extends WebSecurityConfigurerAdapter {
@Autowired
private H2ConsoleProperties console;

View File

@ -56,8 +56,8 @@ public class HypermediaHttpMessageConverterConfiguration {
* {@code Jackson2ModuleRegisteringBeanPostProcessor} has registered the converter and
* it is unordered.
*/
private static class HalMessageConverterSupportedMediaTypesCustomizer implements
BeanFactoryAware {
private static class HalMessageConverterSupportedMediaTypesCustomizer
implements BeanFactoryAware {
private volatile BeanFactory beanFactory;
@ -73,9 +73,9 @@ public class HypermediaHttpMessageConverterConfiguration {
.getMessageConverters()) {
if (converter instanceof TypeConstrainedMappingJackson2HttpMessageConverter) {
((TypeConstrainedMappingJackson2HttpMessageConverter) converter)
.setSupportedMediaTypes(Arrays.asList(
MediaTypes.HAL_JSON,
MediaType.APPLICATION_JSON));
.setSupportedMediaTypes(
Arrays.asList(MediaTypes.HAL_JSON,
MediaType.APPLICATION_JSON));
}
}

View File

@ -43,8 +43,8 @@ public abstract class HazelcastConfigResourceCondition extends ResourceCondition
protected ConditionOutcome getResourceOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
if (System.getProperty(CONFIG_SYSTEM_PROPERTY) != null) {
return ConditionOutcome.match("System property '" + CONFIG_SYSTEM_PROPERTY
+ "' is set.");
return ConditionOutcome
.match("System property '" + CONFIG_SYSTEM_PROPERTY + "' is set.");
}
return super.getResourceOutcome(context, metadata);
}

View File

@ -103,21 +103,23 @@ public class JacksonAutoConfiguration {
SimpleModule module = new SimpleModule();
JacksonJodaDateFormat jacksonJodaFormat = getJacksonJodaDateFormat();
if (jacksonJodaFormat != null) {
module.addSerializer(DateTime.class, new DateTimeSerializer(
jacksonJodaFormat));
module.addSerializer(DateTime.class,
new DateTimeSerializer(jacksonJodaFormat));
}
return module;
}
private JacksonJodaDateFormat getJacksonJodaDateFormat() {
if (this.jacksonProperties.getJodaDateTimeFormat() != null) {
return new JacksonJodaDateFormat(DateTimeFormat.forPattern(
this.jacksonProperties.getJodaDateTimeFormat()).withZoneUTC());
return new JacksonJodaDateFormat(DateTimeFormat
.forPattern(this.jacksonProperties.getJodaDateTimeFormat())
.withZoneUTC());
}
if (this.jacksonProperties.getDateFormat() != null) {
try {
return new JacksonJodaDateFormat(DateTimeFormat.forPattern(
this.jacksonProperties.getDateFormat()).withZoneUTC());
return new JacksonJodaDateFormat(DateTimeFormat
.forPattern(this.jacksonProperties.getDateFormat())
.withZoneUTC());
}
catch (IllegalArgumentException ex) {
if (this.log.isWarnEnabled()) {
@ -163,8 +165,8 @@ public class JacksonAutoConfiguration {
Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
builder.applicationContext(this.applicationContext);
if (this.jacksonProperties.getSerializationInclusion() != null) {
builder.serializationInclusion(this.jacksonProperties
.getSerializationInclusion());
builder.serializationInclusion(
this.jacksonProperties.getSerializationInclusion());
}
if (this.jacksonProperties.getTimeZone() != null) {
builder.timeZone(this.jacksonProperties.getTimeZone());
@ -200,8 +202,8 @@ public class JacksonAutoConfiguration {
if (dateFormat != null) {
try {
Class<?> dateFormatClass = ClassUtils.forName(dateFormat, null);
builder.dateFormat((DateFormat) BeanUtils
.instantiateClass(dateFormatClass));
builder.dateFormat(
(DateFormat) BeanUtils.instantiateClass(dateFormatClass));
}
catch (ClassNotFoundException ex) {
builder.dateFormat(new SimpleDateFormat(dateFormat));
@ -209,7 +211,8 @@ public class JacksonAutoConfiguration {
}
}
private void configurePropertyNamingStrategy(Jackson2ObjectMapperBuilder builder) {
private void configurePropertyNamingStrategy(
Jackson2ObjectMapperBuilder builder) {
// We support a fully qualified class name extending Jackson's
// PropertyNamingStrategy or a string value corresponding to the constant
// names in PropertyNamingStrategy which hold default provided implementations
@ -226,7 +229,8 @@ public class JacksonAutoConfiguration {
}
private void configurePropertyNamingStrategyClass(
Jackson2ObjectMapperBuilder builder, Class<?> propertyNamingStrategyClass) {
Jackson2ObjectMapperBuilder builder,
Class<?> propertyNamingStrategyClass) {
builder.propertyNamingStrategy((PropertyNamingStrategy) BeanUtils
.instantiateClass(propertyNamingStrategyClass));
}

View File

@ -43,8 +43,8 @@ import org.springframework.util.StringUtils;
* @since 1.1.0
*/
@ConfigurationProperties(prefix = DataSourceProperties.PREFIX)
public class DataSourceProperties implements BeanClassLoaderAware, EnvironmentAware,
InitializingBean {
public class DataSourceProperties
implements BeanClassLoaderAware, EnvironmentAware, InitializingBean {
public static final String PREFIX = "spring.datasource";
@ -162,8 +162,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, EnvironmentAw
public String getDriverClassName() {
if (StringUtils.hasText(this.driverClassName)) {
Assert.state(driverClassIsLoadable(), "Cannot load driver class: "
+ this.driverClassName);
Assert.state(driverClassIsLoadable(),
"Cannot load driver class: " + this.driverClassName);
return this.driverClassName;
}
String driverClassName = null;
@ -383,8 +383,9 @@ public class DataSourceProperties implements BeanClassLoaderAware, EnvironmentAw
}
else {
message.append(" (the profiles \""
+ StringUtils.arrayToCommaDelimitedString(environment
.getActiveProfiles()) + "\" are currently active)");
+ StringUtils.arrayToCommaDelimitedString(
environment.getActiveProfiles())
+ "\" are currently active)");
}
}

Some files were not shown because too many files have changed in this diff Show More