This commit is contained in:
Phillip Webb
2024-07-22 19:59:27 +01:00
parent 000600c68a
commit 88480664d7
9 changed files with 61 additions and 50 deletions

View File

@@ -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;

View File

@@ -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");

View File

@@ -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);
}

View File

@@ -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);
}
};
START(DockerCompose::start);
abstract void applyTo(DockerCompose dockerCompose, LogLevel logLevel, List<String> arguments);
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);
}
}

View File

@@ -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);
}
};
STOP(DockerCompose::stop);
abstract void applyTo(DockerCompose dockerCompose, Duration timeout, List<String> arguments);
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);
}
}

View File

@@ -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 {
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);
}

View File

@@ -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,

View File

@@ -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 })

View File

@@ -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 {
* @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 {
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) {