Browse Source

Polish

pull/41587/head
Phillip Webb 1 year ago
parent
commit
88480664d7
  1. 14
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java
  2. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderPropertiesConfiguration.java
  3. 10
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/r2dbc/ProxyConnectionFactoryCustomizer.java
  4. 33
      spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/StartCommand.java
  5. 33
      spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/StopCommand.java
  6. 4
      spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/service/connection/postgres/PostgresEnvironment.java
  7. 1
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java
  8. 1
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/NestedConfigurationProperty.java
  9. 15
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jms/ConnectionFactoryUnwrapper.java

14
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java

@ -148,19 +148,17 @@ public class MailProperties { @@ -148,19 +148,17 @@ public class MailProperties {
public static class Ssl {
/**
* Whether to enable SSL support. If enabled, {@code mail.<protocol>.ssl.enable}
* property is set to {@code true}.
* Whether to enable SSL support. If enabled, 'mail.(protocol).ssl.enable'
* property is set to 'true'.
*/
private boolean enabled = false;
/**
* SSL bundle name. If not null, {@code mail.<protocol>.ssl.socketFactory}
* property is set to a {@code SSLSocketFactory} obtained from the corresponding
* SSL bundle.
* SSL bundle name. If set, 'mail.(protocol).ssl.socketFactory' property is set to
* an SSLSocketFactory obtained from the corresponding SSL bundle.
* <p>
* Note that the {@code STARTTLS} command can use the corresponding
* {@code SSLSocketFactory}, even if {@code mail.<protocol>.ssl.enable} property
* is not set.
* Note that the STARTTLS command can use the corresponding SSLSocketFactory, even
* if the 'mail.(protocol).ssl.enable' property is not set.
*/
private String bundle;

4
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderPropertiesConfiguration.java

@ -64,9 +64,7 @@ class MailSenderPropertiesConfiguration { @@ -64,9 +64,7 @@ class MailSenderPropertiesConfiguration {
}
Properties javaMailProperties = asProperties(properties.getProperties());
String protocol = properties.getProtocol();
if (!StringUtils.hasLength(protocol)) {
protocol = "smtp";
}
protocol = (!StringUtils.hasLength(protocol)) ? "smtp" : protocol;
Ssl ssl = properties.getSsl();
if (ssl.isEnabled()) {
javaMailProperties.setProperty("mail." + protocol + ".ssl.enable", "true");

10
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/r2dbc/ProxyConnectionFactoryCustomizer.java

@ -16,21 +16,21 @@ @@ -16,21 +16,21 @@
package org.springframework.boot.autoconfigure.r2dbc;
import io.r2dbc.proxy.ProxyConnectionFactory;
import io.r2dbc.proxy.ProxyConnectionFactory.Builder;
/**
* Callback interface that can be used to customize a
* {@link ProxyConnectionFactory.Builder}.
* Callback interface that can be used to customize a {@link Builder}.
*
* @author Tadaya Tsuyukubo
* @since 3.4.0
*/
@FunctionalInterface
public interface ProxyConnectionFactoryCustomizer {
/**
* Callback to customize a {@link ProxyConnectionFactory.Builder} instance.
* Callback to customize a {@link Builder} instance.
* @param builder the builder to customize
*/
void customize(ProxyConnectionFactory.Builder builder);
void customize(Builder builder);
}

33
spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/StartCommand.java

@ -34,23 +34,28 @@ public enum StartCommand { @@ -34,23 +34,28 @@ public enum StartCommand {
/**
* Start using {@code docker compose up}.
*/
UP {
@Override
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments) {
dockerCompose.up(logLevel, arguments);
}
},
UP(DockerCompose::up),
/**
* Start using {@code docker compose start}.
*/
START {
@Override
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments) {
dockerCompose.start(logLevel, arguments);
}
};
abstract void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments);
START(DockerCompose::start);
private final Command command;
StartCommand(Command command) {
this.command = command;
}
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments) {
this.command.applyTo(dockerCompose, logLevel, arguments);
}
@FunctionalInterface
private interface Command {
void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments);
}
}

33
spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/StopCommand.java

@ -34,23 +34,28 @@ public enum StopCommand { @@ -34,23 +34,28 @@ public enum StopCommand {
/**
* Stop using {@code docker compose down}.
*/
DOWN {
@Override
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments) {
dockerCompose.down(timeout, arguments);
}
},
DOWN(DockerCompose::down),
/**
* Stop using {@code docker compose stop}.
*/
STOP {
@Override
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments) {
dockerCompose.stop(timeout, arguments);
}
};
abstract void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments);
STOP(DockerCompose::stop);
private final Command command;
StopCommand(Command command) {
this.command = command;
}
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments) {
this.command.applyTo(dockerCompose, timeout, arguments);
}
@FunctionalInterface
private interface Command {
void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments);
}
}

4
spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/service/connection/postgres/PostgresEnvironment.java

@ -45,7 +45,7 @@ class PostgresEnvironment { @@ -45,7 +45,7 @@ class PostgresEnvironment {
}
private String extractPassword(Map<String, String> env) {
if (hasTrustHostAuthMethod(env)) {
if (isUsingTrustHostAuthMethod(env)) {
return null;
}
String password = env.getOrDefault("POSTGRES_PASSWORD", env.get("POSTGRESQL_PASSWORD"));
@ -53,7 +53,7 @@ class PostgresEnvironment { @@ -53,7 +53,7 @@ class PostgresEnvironment {
return password;
}
private Boolean hasTrustHostAuthMethod(Map<String, String> env) {
private boolean isUsingTrustHostAuthMethod(Map<String, String> env) {
String hostAuthMethod = env.get("POSTGRES_HOST_AUTH_METHOD");
return "trust".equals(hostAuthMethod);
}

1
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java

@ -175,6 +175,7 @@ public class BuildRequest { @@ -175,6 +175,7 @@ public class BuildRequest {
* @param trustBuilder {@code true} if the builder should be treated as trusted,
* {@code false} otherwise
* @return an updated build request
* @since 3.4.0
*/
public BuildRequest withTrustBuilder(boolean trustBuilder) {
return new BuildRequest(this.name, this.applicationContent, this.builder, this.runImage, this.creator, this.env,

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

@ -74,6 +74,7 @@ import org.springframework.boot.context.properties.bind.Nested; @@ -74,6 +74,7 @@ import org.springframework.boot.context.properties.bind.Nested;
*
* @author Stephane Nicoll
* @author Phillip Webb
* @author Jared Bates
* @since 1.2.0
*/
@Target({ ElementType.FIELD, ElementType.RECORD_COMPONENT, ElementType.METHOD })

15
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jms/ConnectionFactoryUnwrapper.java

@ -26,9 +26,12 @@ import org.springframework.jms.connection.CachingConnectionFactory; @@ -26,9 +26,12 @@ import org.springframework.jms.connection.CachingConnectionFactory;
* pooling.
*
* @author Stephane Nicoll
* @since 6.4.0
* @since 3.4.0
*/
public abstract class ConnectionFactoryUnwrapper {
public final class ConnectionFactoryUnwrapper {
private ConnectionFactoryUnwrapper() {
}
/**
* Return the native {@link ConnectionFactory} by unwrapping it from a cache or pool
@ -38,8 +41,8 @@ public abstract class ConnectionFactoryUnwrapper { @@ -38,8 +41,8 @@ public abstract class ConnectionFactoryUnwrapper {
* @return the native connection factory that it wraps, if any
*/
public static ConnectionFactory unwrap(ConnectionFactory connectionFactory) {
if (connectionFactory instanceof CachingConnectionFactory ccf) {
return unwrap(ccf.getTargetConnectionFactory());
if (connectionFactory instanceof CachingConnectionFactory cachingConnectionFactory) {
return unwrap(cachingConnectionFactory.getTargetConnectionFactory());
}
ConnectionFactory unwrapedConnectionFactory = unwrapFromJmsPoolConnectionFactory(connectionFactory);
return (unwrapedConnectionFactory != null) ? unwrap(unwrapedConnectionFactory) : connectionFactory;
@ -47,8 +50,8 @@ public abstract class ConnectionFactoryUnwrapper { @@ -47,8 +50,8 @@ public abstract class ConnectionFactoryUnwrapper {
private static ConnectionFactory unwrapFromJmsPoolConnectionFactory(ConnectionFactory connectionFactory) {
try {
if (connectionFactory instanceof JmsPoolConnectionFactory poolConnectionFactory) {
return (ConnectionFactory) poolConnectionFactory.getConnectionFactory();
if (connectionFactory instanceof JmsPoolConnectionFactory jmsPoolConnectionFactory) {
return (ConnectionFactory) jmsPoolConnectionFactory.getConnectionFactory();
}
}
catch (Throwable ex) {

Loading…
Cancel
Save