Skip to content

Commit e891aa3

Browse files
author
Phillip Webb
committed
Polish
1 parent 93aefa8 commit e891aa3

File tree

30 files changed

+195
-173
lines changed

30 files changed

+195
-173
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,12 @@
8181
* into a Spring Boot enabled application. By default a SSH daemon is started on port
8282
* 2000. If the CRaSH Telnet plugin is available on the classpath, Telnet daemon will be
8383
* launched on port 5000.
84-
*
8584
* <p>
8685
* The default shell authentication method uses a username and password combination. If no
8786
* configuration is provided the default username is 'user' and the password will be
8887
* printed to console during application startup. Those default values can be overridden
8988
* by using <code>shell.auth.simple.username</code> and
9089
* <code>shell.auth.simple.password</code>.
91-
*
9290
* <p>
9391
* If a Spring Security {@link AuthenticationManager} is detected, this configuration will
9492
* create a {@link CRaSHPlugin} to forward shell authentication requests to Spring
@@ -98,21 +96,19 @@
9896
* restricted to users having roles that match those configured in
9997
* {@link ManagementServerProperties}. Required roles can be overridden by
10098
* <code>shell.auth.spring.roles</code>.
101-
*
10299
* <p>
103100
* To add customizations to the shell simply define beans of type {@link CRaSHPlugin} in
104101
* the application context. Those beans will get auto detected during startup and
105102
* registered with the underlying shell infrastructure. To configure plugins and the CRaSH
106103
* infrastructure add beans of type {@link CrshShellProperties} to the application
107104
* context.
108-
*
109105
* <p>
110106
* Additional shell commands can be implemented using the guide and documentation at <a
111107
* href="http://www.crashub.org">crashub.org</a>. By default Boot will search for commands
112108
* using the following classpath scanning pattern <code>classpath*:/commands/**</code>. To
113109
* add different locations or override the default use
114110
* <code>shell.command_path_patterns</code> in your application configuration.
115-
*
111+
*
116112
* @author Christian Dupuis
117113
* @see ShellProperties
118114
*/

spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
/**
6060
* Tests for {@link CrshAutoConfiguration}.
61-
*
61+
*
6262
* @author Christian Dupuis
6363
*/
6464
@SuppressWarnings({ "rawtypes", "unchecked" })

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public abstract class AutoConfigurationPackages {
4848

4949
/**
5050
* Determine if the auto-configuration base packages for the given bean factory are
51-
* available
51+
* available.
5252
* @param beanFactory the source bean factory
5353
* @return true if there are auto-config packages available
5454
*/

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
On * Copyright 2012-2014 the original author or authors.
2+
* Copyright 2012-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/**
3333
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
3434
* Auto-configuration} for Elasticsearch.
35-
*
35+
*
3636
* @author Artur Konczak
3737
* @author Mohsin Husen
3838
* @author Andy Wilkinson
@@ -54,17 +54,19 @@ public class ElasticsearchAutoConfiguration implements DisposableBean {
5454
@Bean
5555
public Client elasticsearchClient() {
5656
try {
57-
if (StringUtils.hasLength(this.properties.getClusterNodes())) {
58-
this.client = createTransportClient();
59-
}
60-
else {
61-
this.client = createNodeClient();
62-
}
57+
this.client = createClient();
58+
return this.client;
6359
}
6460
catch (Exception ex) {
6561
throw new IllegalStateException(ex);
6662
}
67-
return this.client;
63+
}
64+
65+
private Client createClient() throws Exception {
66+
if (StringUtils.hasLength(this.properties.getClusterNodes())) {
67+
return createTransportClient();
68+
}
69+
return createNodeClient();
6870
}
6971

7072
private Client createNodeClient() throws Exception {

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/**
2222
* Configuration properties for Elasticsearch.
23-
*
23+
*
2424
* @author Artur Konczak
2525
* @author Mohsin Husen
2626
* @since 1.1.0

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 the original author or authors.
2+
* Copyright 2012-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
3232
*
3333
* @author Artem Bilan
3434
* @author Dave Syer
35-
* @since 1.1
35+
* @since 1.1.0
3636
*/
3737
@Configuration
3838
@ConditionalOnClass(EnableIntegration.class)

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* <li>auto-registration for all {@link Module} beans with all {@link ObjectMapper} beans
5050
* (including the defaulted ones).</li>
5151
* </ul>
52-
*
52+
*
5353
* @author Oliver Gierke
5454
* @since 1.1.0
5555
*/
@@ -65,31 +65,27 @@ public class JacksonAutoConfiguration {
6565
private ListableBeanFactory beanFactory;
6666

6767
@Bean
68-
@ConditionalOnMissingBean
6968
@Primary
69+
@ConditionalOnMissingBean
7070
public ObjectMapper jacksonObjectMapper() {
71-
7271
ObjectMapper objectMapper = new ObjectMapper();
73-
7472
if (this.properties.isJsonSortKeys()) {
7573
objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
7674
}
77-
7875
return objectMapper;
7976
}
8077

8178
@PostConstruct
82-
public void init() {
79+
private void registerModulesWithObjectMappers() {
80+
Collection<Module> modules = getBeans(Module.class);
81+
for (ObjectMapper objectMapper : getBeans(ObjectMapper.class)) {
82+
objectMapper.registerModules(modules);
83+
}
84+
}
8385

84-
Collection<ObjectMapper> mappers = BeanFactoryUtils
85-
.beansOfTypeIncludingAncestors(this.beanFactory, ObjectMapper.class)
86+
private <T> Collection<T> getBeans(Class<T> type) {
87+
return BeanFactoryUtils.beansOfTypeIncludingAncestors(this.beanFactory, type)
8688
.values();
87-
Collection<Module> modules = BeanFactoryUtils.beansOfTypeIncludingAncestors(
88-
this.beanFactory, Module.class).values();
89-
90-
for (ObjectMapper mapper : mappers) {
91-
mapper.registerModules(modules);
92-
}
9389
}
9490

9591
@Configuration
@@ -101,6 +97,7 @@ static class JodaModuleAutoConfiguration {
10197
JodaModule jacksonJodaModule() {
10298
return new JodaModule();
10399
}
100+
104101
}
105102

106103
@Configuration
@@ -113,5 +110,6 @@ static class Jsr310ModuleAutoConfiguration {
113110
JSR310Module jacksonJsr310Module() {
114111
return new JSR310Module();
115112
}
113+
116114
}
117115
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353

5454
/**
5555
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
56-
* Auto-configuration} to integrate with an HornetQ broker. If the necessary
57-
* classes are present, embed the broker in the application by default. Otherwise,
58-
* connect to a broker available on the local machine with the default settings.
56+
* Auto-configuration} to integrate with an HornetQ broker. If the necessary classes are
57+
* present, embed the broker in the application by default. Otherwise, connect to a broker
58+
* available on the local machine with the default settings.
5959
*
6060
* @author Stephane Nicoll
6161
* @since 1.1.0

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
@Import(DataSourceInitializedPublisher.Registrar.class)
5959
public abstract class JpaBaseConfiguration implements BeanFactoryAware {
6060

61+
private static final String[] NO_PACKAGES = new String[0];
62+
6163
private ConfigurableListableBeanFactory beanFactory;
6264

6365
@Autowired
@@ -118,7 +120,7 @@ protected String[] getPackagesToScan() {
118120
List<String> basePackages = AutoConfigurationPackages.get(this.beanFactory);
119121
return basePackages.toArray(new String[basePackages.size()]);
120122
}
121-
return new String[0];
123+
return NO_PACKAGES;
122124
}
123125

124126
protected void configure(

0 commit comments

Comments
 (0)