Skip to content

Commit 6075682

Browse files
committed
Polishing
- Code formatting - Javadoc warnings - Deprecation warnings
1 parent 1c715ab commit 6075682

File tree

14 files changed

+73
-57
lines changed

14 files changed

+73
-57
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAnnotationDrivenConfiguration.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class RabbitAnnotationDrivenConfiguration {
4343
@Bean
4444
@ConditionalOnMissingBean
4545
public SimpleRabbitListenerContainerFactoryConfigurer rabbitListenerContainerFactoryConfigurer() {
46-
SimpleRabbitListenerContainerFactoryConfigurer configurer =
47-
new SimpleRabbitListenerContainerFactoryConfigurer();
46+
SimpleRabbitListenerContainerFactoryConfigurer configurer = new SimpleRabbitListenerContainerFactoryConfigurer();
4847
configurer.setRabbitProperties(this.properties);
4948
return configurer;
5049
}
@@ -54,8 +53,7 @@ public SimpleRabbitListenerContainerFactoryConfigurer rabbitListenerContainerFac
5453
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(
5554
SimpleRabbitListenerContainerFactoryConfigurer configurer,
5655
ConnectionFactory connectionFactory) {
57-
SimpleRabbitListenerContainerFactory factory =
58-
new SimpleRabbitListenerContainerFactory();
56+
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
5957
configurer.configure(factory, connectionFactory);
6058
return factory;
6159
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* Callback interface that can be implemented by beans wishing to customize the cache
2323
* manager before it is fully initialized, in particular to tune its configuration.
2424
*
25+
* @param <C> The type of the {@link CacheManager}
2526
* @author Stephane Nicoll
2627
* @since 1.3.3
2728
*/

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheManagerCustomizerInvoker.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,30 @@ class CacheManagerCustomizerInvoker implements ApplicationContextAware {
4141
private ConfigurableApplicationContext applicationContext;
4242

4343
/**
44-
* Customize the specified {@link CacheManager}. Locates all {@link CacheManagerCustomizer}
45-
* beans able to handle the specified instance and invoke
46-
* {@link CacheManagerCustomizer#customize(CacheManager)} on them.
44+
* Customize the specified {@link CacheManager}. Locates all
45+
* {@link CacheManagerCustomizer} beans able to handle the specified instance and
46+
* invoke {@link CacheManagerCustomizer#customize(CacheManager)} on them.
4747
* @param cacheManager the cache manager to customize
4848
*/
4949
public void customize(CacheManager cacheManager) {
50-
List<CacheManagerCustomizer<CacheManager>> customizers = findCustomizers(cacheManager);
50+
List<CacheManagerCustomizer<CacheManager>> customizers = findCustomizers(
51+
cacheManager);
5152
AnnotationAwareOrderComparator.sort(customizers);
5253
for (CacheManagerCustomizer<CacheManager> customizer : customizers) {
5354
customizer.customize(cacheManager);
5455
}
5556
}
5657

57-
@SuppressWarnings("unchecked")
58-
private List<CacheManagerCustomizer<CacheManager>> findCustomizers(CacheManager cacheManager) {
58+
@SuppressWarnings({ "unchecked", "rawtypes" })
59+
private List<CacheManagerCustomizer<CacheManager>> findCustomizers(
60+
CacheManager cacheManager) {
5961
if (this.applicationContext == null) {
6062
return Collections.emptyList();
6163
}
6264
Map<String, CacheManagerCustomizer> map = BeanFactoryUtils
63-
.beansOfTypeIncludingAncestors(this.applicationContext.getBeanFactory(), CacheManagerCustomizer.class);
64-
List<CacheManagerCustomizer<CacheManager>> customizers
65-
= new ArrayList<CacheManagerCustomizer<CacheManager>>();
65+
.beansOfTypeIncludingAncestors(this.applicationContext.getBeanFactory(),
66+
CacheManagerCustomizer.class);
67+
List<CacheManagerCustomizer<CacheManager>> customizers = new ArrayList<CacheManagerCustomizer<CacheManager>>();
6668
for (CacheManagerCustomizer customizer : map.values()) {
6769
Class<?> target = GenericTypeResolver.resolveTypeArgument(
6870
customizer.getClass(), CacheManagerCustomizer.class);
@@ -73,9 +75,9 @@ private List<CacheManagerCustomizer<CacheManager>> findCustomizers(CacheManager
7375
return customizers;
7476
}
7577

76-
7778
@Override
78-
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
79+
public void setApplicationContext(ApplicationContext applicationContext)
80+
throws BeansException {
7981
if (applicationContext instanceof ConfigurableApplicationContext) {
8082
this.applicationContext = (ConfigurableApplicationContext) applicationContext;
8183
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@
4141
* @see HazelcastConfigResourceCondition
4242
*/
4343
@Configuration
44-
@ConditionalOnClass({HazelcastInstance.class, HazelcastCacheManager.class})
44+
@ConditionalOnClass({ HazelcastInstance.class, HazelcastCacheManager.class })
4545
@ConditionalOnMissingBean(CacheManager.class)
4646
@Conditional(CacheCondition.class)
47-
@Import({HazelcastInstanceConfiguration.Existing.class, HazelcastInstanceConfiguration.Specific.class})
47+
@Import({ HazelcastInstanceConfiguration.Existing.class,
48+
HazelcastInstanceConfiguration.Specific.class })
4849
class HazelcastCacheConfiguration {
4950

5051
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastInstanceConfiguration.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public HazelcastCacheManager cacheManager(
6161
location).getHazelcastInstance();
6262
return new CloseableHazelcastCacheManager(cacheHazelcastInstance);
6363
}
64-
HazelcastCacheManager cacheManager = new HazelcastCacheManager(existingHazelcastInstance);
64+
HazelcastCacheManager cacheManager = new HazelcastCacheManager(
65+
existingHazelcastInstance);
6566
this.customizerInvoker.customize(cacheManager);
6667
return cacheManager;
6768
}
@@ -90,14 +91,14 @@ public HazelcastInstance hazelcastInstance() throws IOException {
9091

9192
@Bean
9293
public HazelcastCacheManager cacheManager() throws IOException {
93-
HazelcastCacheManager cacheManager = new HazelcastCacheManager(hazelcastInstance());
94+
HazelcastCacheManager cacheManager = new HazelcastCacheManager(
95+
hazelcastInstance());
9496
this.customizerInvoker.customize(cacheManager);
9597
return cacheManager;
9698
}
9799

98100
}
99101

100-
101102
/**
102103
* {@link HazelcastConfigResourceCondition} that checks if the
103104
* {@code spring.cache.hazelcast.config} configuration key is defined.

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/InfinispanCacheConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public class InfinispanCacheConfiguration {
6060
@Bean
6161
public SpringEmbeddedCacheManager cacheManager(
6262
EmbeddedCacheManager embeddedCacheManager) {
63-
SpringEmbeddedCacheManager cacheManager = new SpringEmbeddedCacheManager(embeddedCacheManager);
63+
SpringEmbeddedCacheManager cacheManager = new SpringEmbeddedCacheManager(
64+
embeddedCacheManager);
6465
this.customizerInvoker.customize(cacheManager);
6566
return cacheManager;
6667
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/DefaultJmsListenerContainerFactoryConfigurer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ void setJmsProperties(JmsProperties jmsProperties) {
6363
this.jmsProperties = jmsProperties;
6464
}
6565

66-
6766
/**
6867
* Configure the specified jms listener container factory. The factory can be further
6968
* tuned and default settings can be overridden.

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsAnnotationDrivenConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class JmsAnnotationDrivenConfiguration {
5454
@Bean
5555
@ConditionalOnMissingBean
5656
public DefaultJmsListenerContainerFactoryConfigurer jmsListenerContainerFactoryConfigurer() {
57-
DefaultJmsListenerContainerFactoryConfigurer configurer =
58-
new DefaultJmsListenerContainerFactoryConfigurer();
57+
DefaultJmsListenerContainerFactoryConfigurer configurer = new DefaultJmsListenerContainerFactoryConfigurer();
5958
configurer.setDestinationResolver(this.destinationResolver);
6059
configurer.setTransactionManager(this.transactionManager);
6160
configurer.setJmsProperties(this.properties);

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public IRuntimeConfig embeddedMongoRuntimeConfig() {
113113
private ArtifactStoreBuilder getArtifactStore(Logger logger) {
114114
return new ExtractedArtifactStoreBuilder().defaults(Command.MongoD)
115115
.download(new DownloadConfigBuilder().defaultsForCommand(Command.MongoD)
116-
.progressListener(new Slf4jProgressListener(logger)));
116+
.progressListener(new Slf4jProgressListener(logger)).build());
117117
}
118118

119119
@Bean(initMethod = "start", destroyMethod = "stop")

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,10 @@ public void hazelcastCacheWithConfig() throws IOException {
393393
HazelcastCacheManager.class);
394394
HazelcastInstance actual = getHazelcastInstance(cacheManager);
395395
assertThat(actual, sameInstance(hazelcastInstance));
396-
assertThat(actual.getConfig().getConfigurationUrl(), equalTo(new ClassPathResource(
397-
"org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml").getURL()));
396+
assertThat(actual.getConfig().getConfigurationUrl(),
397+
equalTo(new ClassPathResource(
398+
"org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml")
399+
.getURL()));
398400
cacheManager.getCache("foobar");
399401
assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foobar"));
400402
assertThat(cacheManager.getCacheNames(), hasSize(1));
@@ -431,7 +433,8 @@ public void hazelcastCacheWithMainHazelcastAutoConfiguration() throws IOExceptio
431433
HazelcastCacheManager.class);
432434
HazelcastInstance hazelcastInstance = this.context
433435
.getBean(HazelcastInstance.class);
434-
assertThat(getHazelcastInstance(cacheManager), equalTo((Object) hazelcastInstance));
436+
assertThat(getHazelcastInstance(cacheManager),
437+
equalTo((Object) hazelcastInstance));
435438
assertThat(hazelcastInstance.getConfig().getConfigurationFile(),
436439
equalTo(new ClassPathResource(mainConfig).getFile()));
437440
}
@@ -610,22 +613,27 @@ private <T extends CacheManager> T validateCacheManager(Class<T> type) {
610613
return type.cast(cacheManager);
611614
}
612615

613-
private void testCustomizers(Class<?> config, String cacheType, String... expectedCustomizerNames) {
616+
@SuppressWarnings("rawtypes")
617+
private void testCustomizers(Class<?> config, String cacheType,
618+
String... expectedCustomizerNames) {
614619
load(config, "spring.cache.type=" + cacheType);
615620
CacheManager cacheManager = validateCacheManager(CacheManager.class);
616621
List<String> expected = new ArrayList<String>();
617622
expected.addAll(Arrays.asList(expectedCustomizerNames));
618-
Map<String, CacheManagerTestCustomizer> map =
619-
this.context.getBeansOfType(CacheManagerTestCustomizer.class);
623+
Map<String, CacheManagerTestCustomizer> map = this.context
624+
.getBeansOfType(CacheManagerTestCustomizer.class);
620625
for (Map.Entry<String, CacheManagerTestCustomizer> entry : map.entrySet()) {
621626
if (expected.contains(entry.getKey())) {
622627
expected.remove(entry.getKey());
623-
assertThat("Customizer with name " + entry.getKey() + " should have been " +
624-
"invoked", entry.getValue().cacheManager, sameInstance(cacheManager));
628+
assertThat(
629+
"Customizer with name " + entry.getKey() + " should have been "
630+
+ "invoked",
631+
entry.getValue().cacheManager, sameInstance(cacheManager));
625632
}
626633
else {
627-
assertThat("Customizer with name " + entry.getKey() + " should not have been" +
628-
"invoked", entry.getValue().cacheManager, nullValue());
634+
assertThat("Customizer with name " + entry.getKey()
635+
+ " should not have been" + "invoked",
636+
entry.getValue().cacheManager, nullValue());
629637
}
630638
}
631639
assertThat("The following customizers should have been invoked: " + expected,
@@ -641,7 +649,8 @@ private void load(Class<?> config, String... environment) {
641649
this.context = applicationContext;
642650
}
643651

644-
private static HazelcastInstance getHazelcastInstance(HazelcastCacheManager cacheManager) {
652+
private static HazelcastInstance getHazelcastInstance(
653+
HazelcastCacheManager cacheManager) {
645654
return (HazelcastInstance) new DirectFieldAccessor(cacheManager)
646655
.getPropertyValue("hazelcastInstance");
647656
}
@@ -681,7 +690,8 @@ public Cache secondCache() {
681690
}
682691

683692
@Configuration
684-
@Import({GenericCacheConfiguration.class, CacheManagerCustomizersConfiguration.class})
693+
@Import({ GenericCacheConfiguration.class,
694+
CacheManagerCustomizersConfiguration.class })
685695
static class GenericCacheAndCustomizersConfiguration {
686696
}
687697

@@ -697,7 +707,7 @@ static class RedisCacheConfiguration {
697707
}
698708

699709
@Configuration
700-
@Import({RedisCacheConfiguration.class, CacheManagerCustomizersConfiguration.class})
710+
@Import({ RedisCacheConfiguration.class, CacheManagerCustomizersConfiguration.class })
701711
static class RedisCacheAndCustomizersConfiguration {
702712

703713
}
@@ -775,8 +785,8 @@ public HazelcastInstance customHazelcastInstance() {
775785
}
776786

777787
@Configuration
778-
@ImportAutoConfiguration({CacheAutoConfiguration.class,
779-
HazelcastAutoConfiguration.class})
788+
@ImportAutoConfiguration({ CacheAutoConfiguration.class,
789+
HazelcastAutoConfiguration.class })
780790
static class HazelcastAndCacheConfiguration {
781791

782792
}
@@ -795,7 +805,7 @@ public ConfigurationBuilder configurationBuilder() {
795805
}
796806

797807
@Configuration
798-
@Import({GenericCacheConfiguration.class, RedisCacheConfiguration.class})
808+
@Import({ GenericCacheConfiguration.class, RedisCacheConfiguration.class })
799809
static class CustomCacheManagerConfiguration {
800810

801811
@Bean
@@ -806,7 +816,7 @@ public CacheManager cacheManager() {
806816
}
807817

808818
@Configuration
809-
@Import({GenericCacheConfiguration.class, RedisCacheConfiguration.class})
819+
@Import({ GenericCacheConfiguration.class, RedisCacheConfiguration.class })
810820
static class CustomCacheManagerFromSupportConfiguration
811821
extends CachingConfigurerSupport {
812822

@@ -831,7 +841,7 @@ CacheBuilder<Object, Object> cacheBuilder() {
831841
}
832842

833843
@Configuration
834-
@Import({GenericCacheConfiguration.class, RedisCacheConfiguration.class})
844+
@Import({ GenericCacheConfiguration.class, RedisCacheConfiguration.class })
835845
static class CustomCacheResolverConfiguration extends CachingConfigurerSupport {
836846

837847
@Override
@@ -869,37 +879,44 @@ public CacheManagerCustomizer<ConcurrentMapCacheManager> simpleCacheManagerCusto
869879

870880
@Bean
871881
public CacheManagerCustomizer<SimpleCacheManager> genericCacheManagerCustomizer() {
872-
return new CacheManagerTestCustomizer<SimpleCacheManager>() { };
882+
return new CacheManagerTestCustomizer<SimpleCacheManager>() {
883+
};
873884
}
874885

875886
@Bean
876887
public CacheManagerCustomizer<RedisCacheManager> redisCacheManagerCustomizer() {
877-
return new CacheManagerTestCustomizer<RedisCacheManager>() { };
888+
return new CacheManagerTestCustomizer<RedisCacheManager>() {
889+
};
878890
}
879891

880892
@Bean
881893
public CacheManagerCustomizer<EhCacheCacheManager> ehCacheCacheManagerCustomizer() {
882-
return new CacheManagerTestCustomizer<EhCacheCacheManager>() { };
894+
return new CacheManagerTestCustomizer<EhCacheCacheManager>() {
895+
};
883896
}
884897

885898
@Bean
886899
public CacheManagerCustomizer<HazelcastCacheManager> hazelcastCacheManagerCustomizer() {
887-
return new CacheManagerTestCustomizer<HazelcastCacheManager>() { };
900+
return new CacheManagerTestCustomizer<HazelcastCacheManager>() {
901+
};
888902
}
889903

890904
@Bean
891905
public CacheManagerCustomizer<SpringEmbeddedCacheManager> infinispanCacheManagerCustomizer() {
892-
return new CacheManagerTestCustomizer<SpringEmbeddedCacheManager>() { };
906+
return new CacheManagerTestCustomizer<SpringEmbeddedCacheManager>() {
907+
};
893908
}
894909

895910
@Bean
896911
public CacheManagerCustomizer<GuavaCacheManager> guavaCacheManagerCustomizer() {
897-
return new CacheManagerTestCustomizer<GuavaCacheManager>() { };
912+
return new CacheManagerTestCustomizer<GuavaCacheManager>() {
913+
};
898914
}
899915

900916
}
901917

902-
static abstract class CacheManagerTestCustomizer<C extends CacheManager> implements CacheManagerCustomizer<C> {
918+
static abstract class CacheManagerTestCustomizer<C extends CacheManager>
919+
implements CacheManagerCustomizer<C> {
903920

904921
private C cacheManager;
905922

0 commit comments

Comments
 (0)