Skip to content

Commit 653474f

Browse files
committed
Polish
1 parent 25caded commit 653474f

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/MicrometerTracingAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ private static final class SpanTagAnnotationHandlerConfiguration {
233233

234234
@Bean
235235
SpanTagAnnotationHandler spanTagAnnotationHandler() {
236-
return new SpanTagAnnotationHandler((aClass) -> null, (aClass) -> null);
236+
return new SpanTagAnnotationHandler((valueResolverClass) -> null, (valueExpressionResolverClass) -> null);
237237
}
238238

239239
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ public void setObservationRegistry(ObservationRegistry observationRegistry) {
115115
public void configure(DefaultJmsListenerContainerFactory factory, ConnectionFactory connectionFactory) {
116116
Assert.notNull(factory, "Factory must not be null");
117117
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
118-
factory.setConnectionFactory(connectionFactory);
119-
factory.setPubSubDomain(this.jmsProperties.isPubSubDomain());
120-
factory.setSubscriptionDurable(this.jmsProperties.isSubscriptionDurable());
121-
factory.setClientId(this.jmsProperties.getClientId());
122118
JmsProperties.Listener listenerProperties = this.jmsProperties.getListener();
123119
Session sessionProperties = listenerProperties.getSession();
120+
factory.setConnectionFactory(connectionFactory);
124121
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
122+
map.from(this.jmsProperties::isPubSubDomain).to(factory::setPubSubDomain);
123+
map.from(this.jmsProperties::isSubscriptionDurable).to(factory::setSubscriptionDurable);
124+
map.from(this.jmsProperties::getClientId).to(factory::setClientId);
125125
map.from(this.transactionManager).to(factory::setTransactionManager);
126126
map.from(this.destinationResolver).to(factory::setDestinationResolver);
127127
map.from(this.messageConverter).to(factory::setMessageConverter);

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapper.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void customizeClientBuilder(ClientBuilder clientBuilder, PulsarConnectionDetails
6464
map.from(properties::getConnectionTimeout).to(timeoutProperty(clientBuilder::connectionTimeout));
6565
map.from(properties::getOperationTimeout).to(timeoutProperty(clientBuilder::operationTimeout));
6666
map.from(properties::getLookupTimeout).to(timeoutProperty(clientBuilder::lookupTimeout));
67-
customizeAuthentication(clientBuilder::authentication, properties.getAuthentication());
67+
customizeAuthentication(properties.getAuthentication(), clientBuilder::authentication);
6868
customizeServiceUrlProviderBuilder(clientBuilder::serviceUrl, clientBuilder::serviceUrlProvider, properties,
6969
connectionDetails);
7070
}
@@ -77,21 +77,11 @@ private void customizeServiceUrlProviderBuilder(Consumer<String> serviceUrlConsu
7777
serviceUrlConsumer.accept(connectionDetails.getBrokerUrl());
7878
return;
7979
}
80-
Map<String, Authentication> secondaryAuths = new LinkedHashMap<>();
81-
failoverProperties.getBackupClusters().forEach((cluster) -> {
82-
PulsarProperties.Authentication authentication = cluster.getAuthentication();
83-
if (authentication.getPluginClassName() == null) {
84-
secondaryAuths.put(cluster.getServiceUrl(), null);
85-
}
86-
else {
87-
customizeAuthentication((authPluginClassName, authParams) -> secondaryAuths.put(cluster.getServiceUrl(),
88-
AuthenticationFactory.create(authPluginClassName, authParams)), authentication);
89-
}
90-
});
80+
Map<String, Authentication> secondaryAuths = getSecondaryAuths(failoverProperties);
9181
AutoClusterFailoverBuilder autoClusterFailoverBuilder = new AutoClusterFailoverBuilderImpl();
9282
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
9383
map.from(connectionDetails::getBrokerUrl).to(autoClusterFailoverBuilder::primary);
94-
map.from(new ArrayList<>(secondaryAuths.keySet())).to(autoClusterFailoverBuilder::secondary);
84+
map.from(secondaryAuths::keySet).as(ArrayList::new).to(autoClusterFailoverBuilder::secondary);
9585
map.from(failoverProperties::getFailoverPolicy).to(autoClusterFailoverBuilder::failoverPolicy);
9686
map.from(failoverProperties::getFailOverDelay).to(timeoutProperty(autoClusterFailoverBuilder::failoverDelay));
9787
map.from(failoverProperties::getSwitchBackDelay)
@@ -101,22 +91,38 @@ private void customizeServiceUrlProviderBuilder(Consumer<String> serviceUrlConsu
10191
serviceUrlProviderConsumer.accept(autoClusterFailoverBuilder.build());
10292
}
10393

94+
private Map<String, Authentication> getSecondaryAuths(PulsarProperties.Failover properties) {
95+
Map<String, Authentication> secondaryAuths = new LinkedHashMap<>();
96+
properties.getBackupClusters().forEach((backupCluster) -> {
97+
PulsarProperties.Authentication authenticationProperties = backupCluster.getAuthentication();
98+
if (authenticationProperties.getPluginClassName() == null) {
99+
secondaryAuths.put(backupCluster.getServiceUrl(), null);
100+
}
101+
else {
102+
customizeAuthentication(authenticationProperties, (authPluginClassName, authParams) -> {
103+
Authentication authentication = AuthenticationFactory.create(authPluginClassName, authParams);
104+
secondaryAuths.put(backupCluster.getServiceUrl(), authentication);
105+
});
106+
}
107+
});
108+
return secondaryAuths;
109+
}
110+
104111
void customizeAdminBuilder(PulsarAdminBuilder adminBuilder, PulsarConnectionDetails connectionDetails) {
105112
PulsarProperties.Admin properties = this.properties.getAdmin();
106113
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
107114
map.from(connectionDetails::getAdminUrl).to(adminBuilder::serviceHttpUrl);
108115
map.from(properties::getConnectionTimeout).to(timeoutProperty(adminBuilder::connectionTimeout));
109116
map.from(properties::getReadTimeout).to(timeoutProperty(adminBuilder::readTimeout));
110117
map.from(properties::getRequestTimeout).to(timeoutProperty(adminBuilder::requestTimeout));
111-
customizeAuthentication(adminBuilder::authentication, properties.getAuthentication());
118+
customizeAuthentication(properties.getAuthentication(), adminBuilder::authentication);
112119
}
113120

114-
private void customizeAuthentication(AuthenticationConsumer authentication,
115-
PulsarProperties.Authentication properties) {
116-
if (StringUtils.hasText(properties.getPluginClassName())) {
121+
private void customizeAuthentication(PulsarProperties.Authentication properties, AuthenticationConsumer action) {
122+
String pluginClassName = properties.getPluginClassName();
123+
if (StringUtils.hasText(pluginClassName)) {
117124
try {
118-
authentication.accept(properties.getPluginClassName(),
119-
getAuthenticationParamsJson(properties.getParam()));
125+
action.accept(pluginClassName, getAuthenticationParamsJson(properties.getParam()));
120126
}
121127
catch (UnsupportedAuthenticationException ex) {
122128
throw new IllegalStateException("Unable to configure Pulsar authentication", ex);

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public static class Session {
332332
/**
333333
* The maximum number of sessions that can be stored.
334334
*/
335-
private int maxSessions = 10_000;
335+
private int maxSessions = 10000;
336336

337337
@NestedConfigurationProperty
338338
private final Cookie cookie = new Cookie();

0 commit comments

Comments
 (0)