Skip to content

Commit 2dfd916

Browse files
committed
Polish
1 parent dabe75a commit 2dfd916

File tree

34 files changed

+512
-446
lines changed

34 files changed

+512
-446
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,11 @@ public CloudFoundryReactiveHealthEndpointWebExtension cloudFoundryReactiveHealth
103103
public CloudFoundryInfoEndpointWebExtension cloudFoundryInfoEndpointWebExtension(
104104
GitProperties properties, ObjectProvider<InfoContributor> infoContributors) {
105105
List<InfoContributor> contributors = infoContributors.orderedStream()
106-
.map((infoContributor) -> {
107-
if (infoContributor instanceof GitInfoContributor) {
108-
return new GitInfoContributor(properties,
109-
InfoPropertiesInfoContributor.Mode.FULL);
110-
}
111-
return infoContributor;
112-
}).collect(Collectors.toList());
106+
.map((infoContributor) -> (infoContributor instanceof GitInfoContributor)
107+
? new GitInfoContributor(properties,
108+
InfoPropertiesInfoContributor.Mode.FULL)
109+
: infoContributor)
110+
.collect(Collectors.toList());
113111
return new CloudFoundryInfoEndpointWebExtension(new InfoEndpoint(contributors));
114112
}
115113

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,11 @@ public CloudFoundryHealthEndpointWebExtension cloudFoundryHealthEndpointWebExten
104104
public CloudFoundryInfoEndpointWebExtension cloudFoundryInfoEndpointWebExtension(
105105
GitProperties properties, ObjectProvider<InfoContributor> infoContributors) {
106106
List<InfoContributor> contributors = infoContributors.orderedStream()
107-
.map((infoContributor) -> {
108-
if (infoContributor instanceof GitInfoContributor) {
109-
return new GitInfoContributor(properties,
110-
InfoPropertiesInfoContributor.Mode.FULL);
111-
}
112-
return infoContributor;
113-
}).collect(Collectors.toList());
107+
.map((infoContributor) -> (infoContributor instanceof GitInfoContributor)
108+
? new GitInfoContributor(properties,
109+
InfoPropertiesInfoContributor.Mode.FULL)
110+
: infoContributor)
111+
.collect(Collectors.toList());
114112
return new CloudFoundryInfoEndpointWebExtension(new InfoEndpoint(contributors));
115113
}
116114

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.springframework.context.annotation.Bean;
4949
import org.springframework.context.annotation.Configuration;
5050
import org.springframework.core.env.Environment;
51+
import org.springframework.core.log.LogMessage;
5152

5253
/**
5354
* {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Prometheus.
@@ -142,7 +143,7 @@ private PushGateway getPushGateway(String url) {
142143
return new PushGateway(new URL(url));
143144
}
144145
catch (MalformedURLException ex) {
145-
logger.warn(String.format(
146+
logger.warn(LogMessage.format(
146147
"Invalid PushGateway base url '%s': update your configuration to a valid URL",
147148
url));
148149
return new PushGateway(url);

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ protected boolean isLazyInitialization() {
157157
AbstractApplicationContext context = (AbstractApplicationContext) this.applicationContext;
158158
List<BeanFactoryPostProcessor> postProcessors = context
159159
.getBeanFactoryPostProcessors();
160-
return postProcessors.stream().anyMatch((
161-
postProcessor) -> postProcessor instanceof LazyInitializationBeanFactoryPostProcessor);
160+
return postProcessors.stream().anyMatch(
161+
LazyInitializationBeanFactoryPostProcessor.class::isInstance);
162162
}
163163

164164
private void setClassLoaderIfPossible(ConfigurableApplicationContext child) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextAutoConfigurationTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public void childManagementContextShouldStartForEmbeddedServer() {
5656
contextRunner.withPropertyValues("server.port=0", "management.server.port=0").run(
5757
(context) -> assertThat(tomcatStartedOccurencesIn(this.output.toString()))
5858
.isEqualTo(2));
59-
6059
}
6160

6261
private int tomcatStartedOccurencesIn(String output) {

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/HttpTraceWebFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain,
9191
Principal principal, WebSession session) {
9292
ServerWebExchangeTraceableRequest request = new ServerWebExchangeTraceableRequest(
9393
exchange);
94-
final HttpTrace trace = this.tracer.receivedRequest(request);
94+
HttpTrace trace = this.tracer.receivedRequest(request);
9595
exchange.getResponse().beforeCommit(() -> {
9696
TraceableServerHttpResponse response = new TraceableServerHttpResponse(
9797
exchange.getResponse());

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayMigrationScriptMissingFailureAnalyzer.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,12 @@ protected FailureAnalysis analyze(Throwable rootFailure,
3838
.append("no migration scripts location is configured").toString(),
3939
"Check your Flyway configuration", cause);
4040
}
41-
else {
42-
description.append(String.format(
43-
"none of the following migration scripts locations could be found:%n%n"));
44-
cause.getLocations().forEach((location) -> description
45-
.append(String.format("\t- %s%n", location)));
46-
return new FailureAnalysis(description.toString(),
47-
"Review the locations above or check your Flyway configuration",
48-
cause);
49-
}
41+
description.append(String.format(
42+
"none of the following migration scripts locations could be found:%n%n"));
43+
cause.getLocations().forEach(
44+
(location) -> description.append(String.format("\t- %s%n", location)));
45+
return new FailureAnalysis(description.toString(),
46+
"Review the locations above or check your Flyway configuration", cause);
5047
}
5148

5249
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoReactiveAutoConfiguration.java

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,41 +74,44 @@ public NettyDriverMongoClientSettingsBuilderCustomizer nettyDriverCustomizer(
7474
return new NettyDriverMongoClientSettingsBuilderCustomizer(settings);
7575
}
7676

77-
private static final class NettyDriverMongoClientSettingsBuilderCustomizer
78-
implements MongoClientSettingsBuilderCustomizer, DisposableBean {
77+
}
7978

80-
private final ObjectProvider<MongoClientSettings> settings;
79+
/**
80+
* {@link MongoClientSettingsBuilderCustomizer} to apply Mongo client settings.
81+
*/
82+
private static final class NettyDriverMongoClientSettingsBuilderCustomizer
83+
implements MongoClientSettingsBuilderCustomizer, DisposableBean {
8184

82-
private volatile EventLoopGroup eventLoopGroup;
85+
private final ObjectProvider<MongoClientSettings> settings;
8386

84-
private NettyDriverMongoClientSettingsBuilderCustomizer(
85-
ObjectProvider<MongoClientSettings> settings) {
86-
this.settings = settings;
87-
}
87+
private volatile EventLoopGroup eventLoopGroup;
8888

89-
@Override
90-
public void customize(Builder builder) {
91-
if (!isStreamFactoryFactoryDefined(this.settings.getIfAvailable())) {
92-
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
93-
this.eventLoopGroup = eventLoopGroup;
94-
builder.streamFactoryFactory(NettyStreamFactoryFactory.builder()
95-
.eventLoopGroup(eventLoopGroup).build());
96-
}
97-
}
89+
private NettyDriverMongoClientSettingsBuilderCustomizer(
90+
ObjectProvider<MongoClientSettings> settings) {
91+
this.settings = settings;
92+
}
9893

99-
@Override
100-
public void destroy() {
101-
EventLoopGroup eventLoopGroup = this.eventLoopGroup;
102-
if (eventLoopGroup != null) {
103-
eventLoopGroup.shutdownGracefully().awaitUninterruptibly();
104-
this.eventLoopGroup = null;
105-
}
94+
@Override
95+
public void customize(Builder builder) {
96+
if (!isStreamFactoryFactoryDefined(this.settings.getIfAvailable())) {
97+
NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
98+
this.eventLoopGroup = eventLoopGroup;
99+
builder.streamFactoryFactory(NettyStreamFactoryFactory.builder()
100+
.eventLoopGroup(eventLoopGroup).build());
106101
}
102+
}
107103

108-
private boolean isStreamFactoryFactoryDefined(MongoClientSettings settings) {
109-
return settings != null && settings.getStreamFactoryFactory() != null;
104+
@Override
105+
public void destroy() {
106+
EventLoopGroup eventLoopGroup = this.eventLoopGroup;
107+
if (eventLoopGroup != null) {
108+
eventLoopGroup.shutdownGracefully().awaitUninterruptibly();
109+
this.eventLoopGroup = null;
110110
}
111+
}
111112

113+
private boolean isStreamFactoryFactoryDefined(MongoClientSettings settings) {
114+
return settings != null && settings.getStreamFactoryFactory() != null;
112115
}
113116

114117
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketNettyServerCustomizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class RSocketNettyServerCustomizer implements NettyServerCustomizer {
4343

4444
@Override
4545
public HttpServer apply(HttpServer httpServer) {
46-
final ServerTransport.ConnectionAcceptor acceptor = RSocketFactory.receive()
46+
ServerTransport.ConnectionAcceptor acceptor = RSocketFactory.receive()
4747
.acceptor(this.messageHandlerAcceptor).toConnectionAcceptor();
4848
return httpServer.route((routes) -> routes.ws(this.mappingPath,
4949
WebsocketRouteTransport.newHandler(acceptor)));

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/rsocket/RSocketProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
@ConfigurationProperties("spring.rsocket")
3030
public class RSocketProperties {
3131

32-
private Server server = new Server();
32+
private final Server server = new Server();
3333

3434
public Server getServer() {
3535
return this.server;

0 commit comments

Comments
 (0)