Skip to content

Commit a256602

Browse files
committed
Polish
1 parent 7065a41 commit a256602

File tree

23 files changed

+78
-62
lines changed

23 files changed

+78
-62
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryActuatorAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServl
8585
endpointMediaTypes);
8686
return new CloudFoundryWebEndpointServletHandlerMapping(
8787
new EndpointMapping("/cloudfoundryapplication"),
88-
endpointDiscoverer.discoverEndpoints(), endpointMediaTypes, getCorsConfiguration(),
89-
getSecurityInterceptor(builder, environment));
88+
endpointDiscoverer.discoverEndpoints(), endpointMediaTypes,
89+
getCorsConfiguration(), getSecurityInterceptor(builder, environment));
9090
}
9191

9292
private CloudFoundrySecurityInterceptor getSecurityInterceptor(

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryActuatorAutoConfigurationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,13 @@ public void cloudFoundryManagementEndpointsDisabled() throws Exception {
208208
}
209209

210210
@Test
211-
public void allEndpointsAvailableUnderCloudFoundryWithoutEnablingWeb() throws Exception {
211+
public void allEndpointsAvailableUnderCloudFoundryWithoutEnablingWeb()
212+
throws Exception {
212213
this.context.register(TestConfiguration.class);
213214
this.context.refresh();
214215
CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping();
215-
List<EndpointInfo<WebEndpointOperation>> endpoints = (List<EndpointInfo<WebEndpointOperation>>) handlerMapping.getEndpoints();
216+
List<EndpointInfo<WebEndpointOperation>> endpoints = (List<EndpointInfo<WebEndpointOperation>>) handlerMapping
217+
.getEndpoints();
216218
assertThat(endpoints.size()).isEqualTo(1);
217219
assertThat(endpoints.get(0).getId()).isEqualTo("test");
218220
}

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/AnnotationEndpointDiscoverer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ private Map<Class<?>, EndpointExtensionInfo<T>> discoverExtensions(
163163
private EndpointInfo<T> getEndpointInfo(Map<Class<?>, EndpointInfo<T>> endpoints,
164164
Class<?> beanType, Class<?> endpointClass) {
165165
EndpointInfo<T> endpoint = endpoints.get(endpointClass);
166-
Assert.state(endpoint != null, () -> "Invalid extension '" + beanType.getName()
167-
+ "': no endpoint found with type '" + endpointClass.getName() + "'");
166+
Assert.state(endpoint != null,
167+
() -> "Invalid extension '" + beanType.getName()
168+
+ "': no endpoint found with type '" + endpointClass.getName()
169+
+ "'");
168170
return endpoint;
169171
}
170172

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public DefaultClientResources lettuceClientResources() {
7575
@ConditionalOnMissingBean(RedisConnectionFactory.class)
7676
public LettuceConnectionFactory redisConnectionFactory(
7777
ClientResources clientResources) throws UnknownHostException {
78-
LettuceClientConfiguration clientConfig = getLettuceClientConfiguration(clientResources,
79-
this.properties.getLettuce().getPool());
78+
LettuceClientConfiguration clientConfig = getLettuceClientConfiguration(
79+
clientResources, this.properties.getLettuce().getPool());
8080
return createLettuceConnectionFactory(clientConfig);
8181
}
8282

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
* @author Madhura Bhave
4242
*/
4343
@Configuration
44-
@ConditionalOnClass({ AuthenticationManager.class,
45-
EnableWebSecurity.class })
44+
@ConditionalOnClass({ AuthenticationManager.class, EnableWebSecurity.class })
4645
@EnableConfigurationProperties(SecurityProperties.class)
4746
@Import({ SpringBootWebSecurityConfiguration.class, WebSecurityEnablerConfiguration.class,
4847
AuthenticationManagerConfiguration.class, SecurityDataConfiguration.class })

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ private static ClientRegistration getClientRegistration(String registrationId,
7070

7171
private static Builder getBuilder(String registrationId, String configuredProviderId,
7272
Map<String, Provider> providers) {
73-
String providerId = (configuredProviderId == null ? registrationId : configuredProviderId);
73+
String providerId = (configuredProviderId == null ? registrationId
74+
: configuredProviderId);
7475
CommonOAuth2Provider provider = getCommonProvider(providerId);
7576
if (provider == null && !providers.containsKey(providerId)) {
76-
throw new IllegalStateException(getErrorMessage(configuredProviderId, registrationId));
77+
throw new IllegalStateException(
78+
getErrorMessage(configuredProviderId, registrationId));
7779
}
7880
Builder builder = (provider != null ? provider.getBuilder(registrationId)
7981
: ClientRegistration.withRegistrationId(registrationId));
@@ -83,9 +85,12 @@ private static Builder getBuilder(String registrationId, String configuredProvid
8385
return builder;
8486
}
8587

86-
private static String getErrorMessage(String configuredProviderId, String registrationId) {
87-
return (configuredProviderId == null ? "Provider ID must be specified for client registration '" + registrationId + "'" :
88-
"Unknown provider ID '" + configuredProviderId + "'");
88+
private static String getErrorMessage(String configuredProviderId,
89+
String registrationId) {
90+
return (configuredProviderId == null
91+
? "Provider ID must be specified for client registration '"
92+
+ registrationId + "'"
93+
: "Unknown provider ID '" + configuredProviderId + "'");
8994
}
9095

9196
private static Builder getBuilder(Builder builder, Provider provider) {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/CustomHibernateJpaAutoConfigurationTests.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,31 @@ public class CustomHibernateJpaAutoConfigurationTests {
5555
.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class,
5656
HibernateJpaAutoConfiguration.class));
5757

58-
5958
@Test
6059
public void namingStrategyDelegatorTakesPrecedence() {
6160
this.contextRunner
6261
.withPropertyValues(
6362
"spring.jpa.properties.hibernate.ejb.naming_strategy_delegator:"
64-
+ "org.hibernate.cfg.naming.ImprovedNamingStrategyDelegator"
65-
).run((context) -> {
66-
JpaProperties bean = context.getBean(JpaProperties.class);
67-
Map<String, String> hibernateProperties = bean
68-
.getHibernateProperties("create-drop");
69-
assertThat(hibernateProperties.get("hibernate.ejb.naming_strategy")).isNull();
70-
});
63+
+ "org.hibernate.cfg.naming.ImprovedNamingStrategyDelegator")
64+
.run((context) -> {
65+
JpaProperties bean = context.getBean(JpaProperties.class);
66+
Map<String, String> hibernateProperties = bean
67+
.getHibernateProperties("create-drop");
68+
assertThat(hibernateProperties.get("hibernate.ejb.naming_strategy"))
69+
.isNull();
70+
});
7171
}
7272

7373
@Test
7474
public void defaultDatabaseForH2() {
75-
this.contextRunner.withPropertyValues(
76-
"spring.datasource.url:jdbc:h2:mem:testdb",
75+
this.contextRunner.withPropertyValues("spring.datasource.url:jdbc:h2:mem:testdb",
7776
"spring.datasource.initialize:false").run((context) -> {
78-
HibernateJpaVendorAdapter bean = context
79-
.getBean(HibernateJpaVendorAdapter.class);
80-
Database database = (Database) ReflectionTestUtils.getField(bean, "database");
81-
assertThat(database).isEqualTo(Database.H2);
82-
});
77+
HibernateJpaVendorAdapter bean = context
78+
.getBean(HibernateJpaVendorAdapter.class);
79+
Database database = (Database) ReflectionTestUtils.getField(bean,
80+
"database");
81+
assertThat(database).isEqualTo(Database.H2);
82+
});
8383
}
8484

8585
@Configuration

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ public void providerDisablesAutoCommitIsNotConfiguredWithJta() {
258258

259259
@Test
260260
public void customResourceMapping() {
261-
contextRunner()
262-
.withClassLoader(new HideDataScriptClassLoader())
261+
contextRunner().withClassLoader(new HideDataScriptClassLoader())
263262
.withPropertyValues(
264263
"spring.datasource.data:classpath:/db/non-annotated-data.sql",
265264
"spring.jpa.mapping-resources=META-INF/mappings/non-annotated.xml")

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapterTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ public void getClientRegistrationsWhenProviderNotSpecifiedAndUnknownProviderShou
208208
Registration registration = new Registration();
209209
properties.getRegistration().put("missing", registration);
210210
this.thrown.expect(IllegalStateException.class);
211-
this.thrown.expectMessage("Provider ID must be specified for client registration 'missing'");
211+
this.thrown.expectMessage(
212+
"Provider ID must be specified for client registration 'missing'");
212213
OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(properties);
213214
}
214215

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2WebSecurityConfigurationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ public ClientRegistrationRepository clientRegistrationRepository() {
154154
}
155155

156156
private ClientRegistration getClientRegistration(String id, String userInfoUri) {
157-
ClientRegistration.Builder builder = ClientRegistration.withRegistrationId(id);
157+
ClientRegistration.Builder builder = ClientRegistration
158+
.withRegistrationId(id);
158159
builder.clientName("foo").clientId("foo")
159160
.clientAuthenticationMethod(
160161
org.springframework.security.oauth2.core.ClientAuthenticationMethod.BASIC)

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/ReactiveSecurityAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ public void doesNotConfigureDefaultUserIfAuthenticationManagerAvailable() {
103103
TestConfig.class)
104104
.withConfiguration(
105105
AutoConfigurations.of(ReactiveSecurityAutoConfiguration.class))
106-
.run((context) -> assertThat(context).getBean(ReactiveUserDetailsService.class)
107-
.isNull());
106+
.run((context) -> assertThat(context)
107+
.getBean(ReactiveUserDetailsService.class).isNull());
108108
}
109109

110110
@Configuration

spring-boot-project/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ private File findLaunchScript() throws IOException {
9393
}
9494
File bin = new File(unpacked.listFiles()[0], "bin");
9595
File launchScript = new File(bin, isWindows() ? "spring.bat" : "spring");
96-
Assert.state(launchScript.exists() && launchScript.isFile(), () ->
97-
"Could not find CLI launch script " + launchScript.getAbsolutePath());
96+
Assert.state(launchScript.exists() && launchScript.isFile(),
97+
() -> "Could not find CLI launch script "
98+
+ launchScript.getAbsolutePath());
9899
return launchScript;
99100
}
100101

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
* @author Stephane Nicoll
4040
*/
4141
@RunWith(SpringRunner.class)
42-
@SpringBootTest(properties = "spring.main.web-application-type=reactive", classes = { WebTestClientSpringBootTestIntegrationTests.TestConfiguration.class,
43-
ExampleWebFluxApplication.class })
42+
@SpringBootTest(properties = "spring.main.web-application-type=reactive", classes = {
43+
WebTestClientSpringBootTestIntegrationTests.TestConfiguration.class,
44+
ExampleWebFluxApplication.class })
4445
@AutoConfigureWebTestClient
4546
public class WebTestClientSpringBootTestIntegrationTests {
4647

@@ -71,7 +72,8 @@ public void shouldHaveRealService() throws Exception {
7172
@Configuration
7273
static class TestConfiguration {
7374
@Bean
74-
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) throws Exception {
75+
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http)
76+
throws Exception {
7577
http.authorizeExchange().anyExchange().permitAll();
7678
return http.build();
7779
}

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ private void parseSpyBeanAnnotation(SpyBean annotation, AnnotatedElement element
109109
private void addDefinition(AnnotatedElement element, Definition definition,
110110
String type) {
111111
boolean isNewDefinition = this.definitions.add(definition);
112-
Assert.state(isNewDefinition, () ->
113-
"Duplicate " + type + " definition " + definition);
112+
Assert.state(isNewDefinition,
113+
() -> "Duplicate " + type + " definition " + definition);
114114
if (element instanceof Field) {
115115
Field field = (Field) element;
116116
this.definitionFields.put(definition, field);

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
*/
4141
public class BootRun extends DefaultTask {
4242

43-
private final PropertyState<String> mainClassName = getProject().property(String.class);
43+
private final PropertyState<String> mainClassName = getProject()
44+
.property(String.class);
4445

4546
@SuppressWarnings("unchecked")
4647
private final PropertyState<List<String>> jvmArgs = (PropertyState<List<String>>) (Object) getProject()
@@ -90,7 +91,8 @@ public String getMainClassName() {
9091
}
9192

9293
/**
93-
* Sets the name of the main class to be executed using the given {@code mainClassNameProvider}.
94+
* Sets the name of the main class to be executed using the given
95+
* {@code mainClassNameProvider}.
9496
*
9597
* @param mainClassNameProvider provider of the main class name
9698
*/

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ public void applicationPluginMainClass() throws IOException {
9292
@Test
9393
public void springBootDslMainClass() throws IOException {
9494
this.gradleBuild
95-
.script("src/main/gradle/packaging/spring-boot-dsl-main-class.gradle")
96-
.build("bootJar");
95+
.script("src/main/gradle/packaging/spring-boot-dsl-main-class.gradle")
96+
.build("bootJar");
9797
File file = new File(this.gradleBuild.getProjectDir(),
9898
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
9999
assertThat(file).isFile();
100100
try (JarFile jar = new JarFile(file)) {
101101
assertThat(jar.getManifest().getMainAttributes().getValue("Start-Class"))
102-
.isEqualTo("com.example.ExampleApplication");
102+
.isEqualTo("com.example.ExampleApplication");
103103
}
104104
}
105105

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/RunningDocumentationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void springBootDslMainClassName() throws IOException {
5656
assertThat(this.gradleBuild
5757
.script("src/main/gradle/running/spring-boot-dsl-main-class-name.gradle")
5858
.build("configuredMainClass").getOutput())
59-
.contains("com.example.ExampleApplication");
59+
.contains("com.example.ExampleApplication");
6060
}
6161

6262
@Test

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ public void springBootExtensionMainClassNameIsUsed() throws IOException {
120120
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
121121
try (JarFile jarFile = new JarFile(
122122
new File(this.gradleBuild.getProjectDir(), "build/libs")
123-
.listFiles()[0])) {
123+
.listFiles()[0])) {
124124
assertThat(jarFile.getManifest().getMainAttributes().getValue("Start-Class"))
125-
.isEqualTo("com.example.CustomMain");
125+
.isEqualTo("com.example.CustomMain");
126126
}
127127
}
128128

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/GradleBuild.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ private static String evaluateExpression(String expression) {
196196
XPathFactory xPathFactory = XPathFactory.newInstance();
197197
XPath xpath = xPathFactory.newXPath();
198198
XPathExpression expr = xpath.compile(expression);
199-
String version = expr.evaluate(new InputSource(new FileReader(".flattened-pom.xml")));
199+
String version = expr
200+
.evaluate(new InputSource(new FileReader(".flattened-pom.xml")));
200201
return version;
201202
}
202203
catch (Exception ex) {

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/RunArgumentsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public void parseNullArray() {
4343

4444
@Test
4545
public void parseArrayContainingNullValue() {
46-
String[] args = new RunArguments(new String[]{"foo", null, "bar"}).asArray();
46+
String[] args = new RunArguments(new String[] { "foo", null, "bar" }).asArray();
4747
assertThat(args).isNotNull();
4848
assertThat(args).containsOnly("foo", "bar");
4949
}
5050

5151
@Test
5252
public void parseArrayContainingEmptyValue() {
53-
String[] args = new RunArguments(new String[]{"foo", "", "bar"}).asArray();
53+
String[] args = new RunArguments(new String[] { "foo", "", "bar" }).asArray();
5454
assertThat(args).isNotNull();
5555
assertThat(args).containsOnly("foo", "", "bar");
5656
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ private File getTempDirectory() {
9191
Assert.state(StringUtils.hasLength(property), "No 'java.io.tmpdir' property set");
9292
File file = new File(property);
9393
Assert.state(file.exists(), () -> "Temp directory" + file + " does not exist");
94-
Assert.state(file.isDirectory(), () -> "Temp location " + file
95-
+ " is not a directory");
94+
Assert.state(file.isDirectory(),
95+
() -> "Temp location " + file + " is not a directory");
9696
return file;
9797
}
9898

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
* @author Stephane Nicoll
5454
* @author Madhura Bhave
5555
*/
56-
public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProcessor,
57-
BeanFactoryAware, EnvironmentAware, ApplicationContextAware, InitializingBean,
58-
PriorityOrdered {
56+
public class ConfigurationPropertiesBindingPostProcessor
57+
implements BeanPostProcessor, BeanFactoryAware, EnvironmentAware,
58+
ApplicationContextAware, InitializingBean, PriorityOrdered {
5959

6060
private static final Log logger = LogFactory
6161
.getLog(ConfigurationPropertiesBindingPostProcessor.class);

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ public Builder properties(Map<String, ?> properties) {
171171
/**
172172
* The mapping resources (equivalent to {@code <mapping-file>} entries in
173173
* {@code persistence.xml}) for the persistence unit.
174-
* <p>Note that mapping resources must be relative to the classpath root,
175-
* e.g. "META-INF/mappings.xml" or "com/mycompany/repository/mappings.xml",
176-
* so that they can be loaded through {@code ClassLoader.getResource}.
174+
* <p>
175+
* Note that mapping resources must be relative to the classpath root, e.g.
176+
* "META-INF/mappings.xml" or "com/mycompany/repository/mappings.xml", so that
177+
* they can be loaded through {@code ClassLoader.getResource}.
177178
* @param mappingResources the mapping resources to use
178179
* @return the builder for fluent usage
179180
*/

0 commit comments

Comments
 (0)