diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAnnotationDrivenConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAnnotationDrivenConfiguration.java index c17b8d7d18a..0b37e8bab17 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAnnotationDrivenConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAnnotationDrivenConfiguration.java @@ -43,8 +43,7 @@ class RabbitAnnotationDrivenConfiguration { @Bean @ConditionalOnMissingBean public SimpleRabbitListenerContainerFactoryConfigurer rabbitListenerContainerFactoryConfigurer() { - SimpleRabbitListenerContainerFactoryConfigurer configurer = - new SimpleRabbitListenerContainerFactoryConfigurer(); + SimpleRabbitListenerContainerFactoryConfigurer configurer = new SimpleRabbitListenerContainerFactoryConfigurer(); configurer.setRabbitProperties(this.properties); return configurer; } @@ -54,8 +53,7 @@ class RabbitAnnotationDrivenConfiguration { public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory( SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) { - SimpleRabbitListenerContainerFactory factory = - new SimpleRabbitListenerContainerFactory(); + SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); configurer.configure(factory, connectionFactory); return factory; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizer.java index 9ea7c52648e..c3a53d4ba41 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizer.java @@ -22,6 +22,7 @@ import org.springframework.cache.CacheManager; * Callback interface that can be implemented by beans wishing to customize the cache * manager before it is fully initialized, in particular to tune its configuration. * + * @param The type of the {@link CacheManager} * @author Stephane Nicoll * @since 1.3.3 */ diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvoker.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvoker.java index 13f03a1738b..8c667a69e12 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvoker.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvoker.java @@ -41,28 +41,30 @@ class CacheManagerCustomizerInvoker implements ApplicationContextAware { private ConfigurableApplicationContext applicationContext; /** - * Customize the specified {@link CacheManager}. Locates all {@link CacheManagerCustomizer} - * beans able to handle the specified instance and invoke - * {@link CacheManagerCustomizer#customize(CacheManager)} on them. + * Customize the specified {@link CacheManager}. Locates all + * {@link CacheManagerCustomizer} beans able to handle the specified instance and + * invoke {@link CacheManagerCustomizer#customize(CacheManager)} on them. * @param cacheManager the cache manager to customize */ public void customize(CacheManager cacheManager) { - List> customizers = findCustomizers(cacheManager); + List> customizers = findCustomizers( + cacheManager); AnnotationAwareOrderComparator.sort(customizers); for (CacheManagerCustomizer customizer : customizers) { customizer.customize(cacheManager); } } - @SuppressWarnings("unchecked") - private List> findCustomizers(CacheManager cacheManager) { + @SuppressWarnings({ "unchecked", "rawtypes" }) + private List> findCustomizers( + CacheManager cacheManager) { if (this.applicationContext == null) { return Collections.emptyList(); } Map map = BeanFactoryUtils - .beansOfTypeIncludingAncestors(this.applicationContext.getBeanFactory(), CacheManagerCustomizer.class); - List> customizers - = new ArrayList>(); + .beansOfTypeIncludingAncestors(this.applicationContext.getBeanFactory(), + CacheManagerCustomizer.class); + List> customizers = new ArrayList>(); for (CacheManagerCustomizer customizer : map.values()) { Class target = GenericTypeResolver.resolveTypeArgument( customizer.getClass(), CacheManagerCustomizer.class); @@ -73,9 +75,9 @@ class CacheManagerCustomizerInvoker implements ApplicationContextAware { return customizers; } - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { if (applicationContext instanceof ConfigurableApplicationContext) { this.applicationContext = (ConfigurableApplicationContext) applicationContext; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java index 649f0feb2a0..d81dd16e1d4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java @@ -41,10 +41,11 @@ import org.springframework.context.annotation.Import; * @see HazelcastConfigResourceCondition */ @Configuration -@ConditionalOnClass({HazelcastInstance.class, HazelcastCacheManager.class}) +@ConditionalOnClass({ HazelcastInstance.class, HazelcastCacheManager.class }) @ConditionalOnMissingBean(CacheManager.class) @Conditional(CacheCondition.class) -@Import({HazelcastInstanceConfiguration.Existing.class, HazelcastInstanceConfiguration.Specific.class}) +@Import({ HazelcastInstanceConfiguration.Existing.class, + HazelcastInstanceConfiguration.Specific.class }) class HazelcastCacheConfiguration { } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastInstanceConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastInstanceConfiguration.java index a15ebbb61e5..819ac4dbea9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastInstanceConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastInstanceConfiguration.java @@ -61,7 +61,8 @@ abstract class HazelcastInstanceConfiguration { location).getHazelcastInstance(); return new CloseableHazelcastCacheManager(cacheHazelcastInstance); } - HazelcastCacheManager cacheManager = new HazelcastCacheManager(existingHazelcastInstance); + HazelcastCacheManager cacheManager = new HazelcastCacheManager( + existingHazelcastInstance); this.customizerInvoker.customize(cacheManager); return cacheManager; } @@ -90,14 +91,14 @@ abstract class HazelcastInstanceConfiguration { @Bean public HazelcastCacheManager cacheManager() throws IOException { - HazelcastCacheManager cacheManager = new HazelcastCacheManager(hazelcastInstance()); + HazelcastCacheManager cacheManager = new HazelcastCacheManager( + hazelcastInstance()); this.customizerInvoker.customize(cacheManager); return cacheManager; } } - /** * {@link HazelcastConfigResourceCondition} that checks if the * {@code spring.cache.hazelcast.config} configuration key is defined. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java index 8af92877704..555bb745248 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java @@ -60,7 +60,8 @@ public class InfinispanCacheConfiguration { @Bean public SpringEmbeddedCacheManager cacheManager( EmbeddedCacheManager embeddedCacheManager) { - SpringEmbeddedCacheManager cacheManager = new SpringEmbeddedCacheManager(embeddedCacheManager); + SpringEmbeddedCacheManager cacheManager = new SpringEmbeddedCacheManager( + embeddedCacheManager); this.customizerInvoker.customize(cacheManager); return cacheManager; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/DefaultJmsListenerContainerFactoryConfigurer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/DefaultJmsListenerContainerFactoryConfigurer.java index 4655bf47625..d666ce514b3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/DefaultJmsListenerContainerFactoryConfigurer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/DefaultJmsListenerContainerFactoryConfigurer.java @@ -63,7 +63,6 @@ public final class DefaultJmsListenerContainerFactoryConfigurer { this.jmsProperties = jmsProperties; } - /** * Configure the specified jms listener container factory. The factory can be further * tuned and default settings can be overridden. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsAnnotationDrivenConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsAnnotationDrivenConfiguration.java index ff27e40632f..66d3a17afa8 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsAnnotationDrivenConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsAnnotationDrivenConfiguration.java @@ -54,8 +54,7 @@ class JmsAnnotationDrivenConfiguration { @Bean @ConditionalOnMissingBean public DefaultJmsListenerContainerFactoryConfigurer jmsListenerContainerFactoryConfigurer() { - DefaultJmsListenerContainerFactoryConfigurer configurer = - new DefaultJmsListenerContainerFactoryConfigurer(); + DefaultJmsListenerContainerFactoryConfigurer configurer = new DefaultJmsListenerContainerFactoryConfigurer(); configurer.setDestinationResolver(this.destinationResolver); configurer.setTransactionManager(this.transactionManager); configurer.setJmsProperties(this.properties); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index 4215f741267..94ec8017c42 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -113,7 +113,7 @@ public class EmbeddedMongoAutoConfiguration { private ArtifactStoreBuilder getArtifactStore(Logger logger) { return new ExtractedArtifactStoreBuilder().defaults(Command.MongoD) .download(new DownloadConfigBuilder().defaultsForCommand(Command.MongoD) - .progressListener(new Slf4jProgressListener(logger))); + .progressListener(new Slf4jProgressListener(logger)).build()); } @Bean(initMethod = "start", destroyMethod = "stop") diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java index 6b66a2200f4..03b308414b7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java @@ -393,8 +393,10 @@ public class CacheAutoConfigurationTests { HazelcastCacheManager.class); HazelcastInstance actual = getHazelcastInstance(cacheManager); assertThat(actual, sameInstance(hazelcastInstance)); - assertThat(actual.getConfig().getConfigurationUrl(), equalTo(new ClassPathResource( - "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml").getURL())); + assertThat(actual.getConfig().getConfigurationUrl(), + equalTo(new ClassPathResource( + "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml") + .getURL())); cacheManager.getCache("foobar"); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foobar")); assertThat(cacheManager.getCacheNames(), hasSize(1)); @@ -431,7 +433,8 @@ public class CacheAutoConfigurationTests { HazelcastCacheManager.class); HazelcastInstance hazelcastInstance = this.context .getBean(HazelcastInstance.class); - assertThat(getHazelcastInstance(cacheManager), equalTo((Object) hazelcastInstance)); + assertThat(getHazelcastInstance(cacheManager), + equalTo((Object) hazelcastInstance)); assertThat(hazelcastInstance.getConfig().getConfigurationFile(), equalTo(new ClassPathResource(mainConfig).getFile())); } @@ -610,22 +613,27 @@ public class CacheAutoConfigurationTests { return type.cast(cacheManager); } - private void testCustomizers(Class config, String cacheType, String... expectedCustomizerNames) { + @SuppressWarnings("rawtypes") + private void testCustomizers(Class config, String cacheType, + String... expectedCustomizerNames) { load(config, "spring.cache.type=" + cacheType); CacheManager cacheManager = validateCacheManager(CacheManager.class); List expected = new ArrayList(); expected.addAll(Arrays.asList(expectedCustomizerNames)); - Map map = - this.context.getBeansOfType(CacheManagerTestCustomizer.class); + Map map = this.context + .getBeansOfType(CacheManagerTestCustomizer.class); for (Map.Entry entry : map.entrySet()) { if (expected.contains(entry.getKey())) { expected.remove(entry.getKey()); - assertThat("Customizer with name " + entry.getKey() + " should have been " + - "invoked", entry.getValue().cacheManager, sameInstance(cacheManager)); + assertThat( + "Customizer with name " + entry.getKey() + " should have been " + + "invoked", + entry.getValue().cacheManager, sameInstance(cacheManager)); } else { - assertThat("Customizer with name " + entry.getKey() + " should not have been" + - "invoked", entry.getValue().cacheManager, nullValue()); + assertThat("Customizer with name " + entry.getKey() + + " should not have been" + "invoked", + entry.getValue().cacheManager, nullValue()); } } assertThat("The following customizers should have been invoked: " + expected, @@ -641,7 +649,8 @@ public class CacheAutoConfigurationTests { this.context = applicationContext; } - private static HazelcastInstance getHazelcastInstance(HazelcastCacheManager cacheManager) { + private static HazelcastInstance getHazelcastInstance( + HazelcastCacheManager cacheManager) { return (HazelcastInstance) new DirectFieldAccessor(cacheManager) .getPropertyValue("hazelcastInstance"); } @@ -681,7 +690,8 @@ public class CacheAutoConfigurationTests { } @Configuration - @Import({GenericCacheConfiguration.class, CacheManagerCustomizersConfiguration.class}) + @Import({ GenericCacheConfiguration.class, + CacheManagerCustomizersConfiguration.class }) static class GenericCacheAndCustomizersConfiguration { } @@ -697,7 +707,7 @@ public class CacheAutoConfigurationTests { } @Configuration - @Import({RedisCacheConfiguration.class, CacheManagerCustomizersConfiguration.class}) + @Import({ RedisCacheConfiguration.class, CacheManagerCustomizersConfiguration.class }) static class RedisCacheAndCustomizersConfiguration { } @@ -775,8 +785,8 @@ public class CacheAutoConfigurationTests { } @Configuration - @ImportAutoConfiguration({CacheAutoConfiguration.class, - HazelcastAutoConfiguration.class}) + @ImportAutoConfiguration({ CacheAutoConfiguration.class, + HazelcastAutoConfiguration.class }) static class HazelcastAndCacheConfiguration { } @@ -795,7 +805,7 @@ public class CacheAutoConfigurationTests { } @Configuration - @Import({GenericCacheConfiguration.class, RedisCacheConfiguration.class}) + @Import({ GenericCacheConfiguration.class, RedisCacheConfiguration.class }) static class CustomCacheManagerConfiguration { @Bean @@ -806,7 +816,7 @@ public class CacheAutoConfigurationTests { } @Configuration - @Import({GenericCacheConfiguration.class, RedisCacheConfiguration.class}) + @Import({ GenericCacheConfiguration.class, RedisCacheConfiguration.class }) static class CustomCacheManagerFromSupportConfiguration extends CachingConfigurerSupport { @@ -831,7 +841,7 @@ public class CacheAutoConfigurationTests { } @Configuration - @Import({GenericCacheConfiguration.class, RedisCacheConfiguration.class}) + @Import({ GenericCacheConfiguration.class, RedisCacheConfiguration.class }) static class CustomCacheResolverConfiguration extends CachingConfigurerSupport { @Override @@ -869,37 +879,44 @@ public class CacheAutoConfigurationTests { @Bean public CacheManagerCustomizer genericCacheManagerCustomizer() { - return new CacheManagerTestCustomizer() { }; + return new CacheManagerTestCustomizer() { + }; } @Bean public CacheManagerCustomizer redisCacheManagerCustomizer() { - return new CacheManagerTestCustomizer() { }; + return new CacheManagerTestCustomizer() { + }; } @Bean public CacheManagerCustomizer ehCacheCacheManagerCustomizer() { - return new CacheManagerTestCustomizer() { }; + return new CacheManagerTestCustomizer() { + }; } @Bean public CacheManagerCustomizer hazelcastCacheManagerCustomizer() { - return new CacheManagerTestCustomizer() { }; + return new CacheManagerTestCustomizer() { + }; } @Bean public CacheManagerCustomizer infinispanCacheManagerCustomizer() { - return new CacheManagerTestCustomizer() { }; + return new CacheManagerTestCustomizer() { + }; } @Bean public CacheManagerCustomizer guavaCacheManagerCustomizer() { - return new CacheManagerTestCustomizer() { }; + return new CacheManagerTestCustomizer() { + }; } } - static abstract class CacheManagerTestCustomizer implements CacheManagerCustomizer { + static abstract class CacheManagerTestCustomizer + implements CacheManagerCustomizer { private C cacheManager; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvokerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvokerTests.java index 1749250ad6e..38a20031ab0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvokerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvokerTests.java @@ -54,7 +54,8 @@ public class CacheManagerCustomizerInvokerTests { @Test public void customizeSimpleCacheManager() { load(SimpleConfiguration.class, "spring.cache.type=simple"); - ConcurrentMapCacheManager cacheManager = this.context.getBean(ConcurrentMapCacheManager.class); + ConcurrentMapCacheManager cacheManager = this.context + .getBean(ConcurrentMapCacheManager.class); assertThat(cacheManager.getCacheNames(), containsInAnyOrder("one", "two")); assertThat(cacheManager.getCacheNames(), hasSize(2)); } @@ -68,7 +69,6 @@ public class CacheManagerCustomizerInvokerTests { verifyZeroInteractions(context); } - private void load(Class config, String... environment) { AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(applicationContext, environment); @@ -78,7 +78,6 @@ public class CacheManagerCustomizerInvokerTests { this.context = applicationContext; } - @Configuration @EnableCaching static class SimpleConfiguration { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java index efd134b93fe..b0172f44aac 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java @@ -471,8 +471,7 @@ public class JmsAutoConfigurationTests { JmsListenerContainerFactory customListenerContainerFactory( DefaultJmsListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) { - DefaultJmsListenerContainerFactory factory = - new DefaultJmsListenerContainerFactory(); + DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory(); configurer.configure(factory, connectionFactory); factory.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER); return factory; diff --git a/spring-boot-devtools/pom.xml b/spring-boot-devtools/pom.xml index 84720104959..f51219f6c66 100644 --- a/spring-boot-devtools/pom.xml +++ b/spring-boot-devtools/pom.xml @@ -99,7 +99,6 @@ org.eclipse.jetty.websocket websocket-client - ${jetty.version} test diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java index f96337d63ad..fa807322ad2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java @@ -59,7 +59,7 @@ public class TomcatEmbeddedWebappClassLoader extends WebappClassLoader { checkPackageAccess(name); // Perform the actual load - boolean delegateLoad = (this.delegate || filter(name)); + boolean delegateLoad = (this.delegate || filter(name, true)); if (delegateLoad) { resultClass = (resultClass == null ? loadFromParent(name) : resultClass);