Merge pull request #43879 from izeye
* gh-43879: Polish Closes gh-43879
This commit is contained in:
		
						commit
						71c96438ed
					
				| 
						 | 
					@ -63,7 +63,7 @@ class PostgresJdbcDockerComposeConnectionDetailsFactoryIntegrationTests {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@SuppressWarnings("unchecked")
 | 
						@SuppressWarnings("unchecked")
 | 
				
			||||||
	private <T> T executeQuery(JdbcConnectionDetails connectionDetails, String sql, Class<T> result)
 | 
						private <T> T executeQuery(JdbcConnectionDetails connectionDetails, String sql, Class<T> resultClass)
 | 
				
			||||||
			throws ClassNotFoundException {
 | 
								throws ClassNotFoundException {
 | 
				
			||||||
		SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
 | 
							SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
 | 
				
			||||||
		dataSource.setUrl(connectionDetails.getJdbcUrl());
 | 
							dataSource.setUrl(connectionDetails.getJdbcUrl());
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ class PostgresJdbcDockerComposeConnectionDetailsFactoryIntegrationTests {
 | 
				
			||||||
		dataSource.setPassword(connectionDetails.getPassword());
 | 
							dataSource.setPassword(connectionDetails.getPassword());
 | 
				
			||||||
		dataSource.setDriverClass((Class<? extends Driver>) ClassUtils.forName(connectionDetails.getDriverClassName(),
 | 
							dataSource.setDriverClass((Class<? extends Driver>) ClassUtils.forName(connectionDetails.getDriverClassName(),
 | 
				
			||||||
				getClass().getClassLoader()));
 | 
									getClass().getClassLoader()));
 | 
				
			||||||
		return new JdbcTemplate(dataSource).queryForObject(sql, result);
 | 
							return new JdbcTemplate(dataSource).queryForObject(sql, resultClass);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,11 +63,11 @@ class PostgresR2dbcDockerComposeConnectionDetailsFactoryIntegrationTests {
 | 
				
			||||||
			.isEqualTo(1);
 | 
								.isEqualTo(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private <T> T executeQuery(R2dbcConnectionDetails connectionDetails, String sql, Class<T> result) {
 | 
						private <T> T executeQuery(R2dbcConnectionDetails connectionDetails, String sql, Class<T> resultClass) {
 | 
				
			||||||
		ConnectionFactoryOptions connectionFactoryOptions = connectionDetails.getConnectionFactoryOptions();
 | 
							ConnectionFactoryOptions connectionFactoryOptions = connectionDetails.getConnectionFactoryOptions();
 | 
				
			||||||
		return DatabaseClient.create(ConnectionFactories.get(connectionFactoryOptions))
 | 
							return DatabaseClient.create(ConnectionFactories.get(connectionFactoryOptions))
 | 
				
			||||||
			.sql(sql)
 | 
								.sql(sql)
 | 
				
			||||||
			.mapValue(result)
 | 
								.mapValue(resultClass)
 | 
				
			||||||
			.first()
 | 
								.first()
 | 
				
			||||||
			.block(Duration.ofSeconds(30));
 | 
								.block(Duration.ofSeconds(30));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -241,7 +241,7 @@ abstract sealed class DockerCliCommand<R> {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	record ComposeVersion(int major, int minor) {
 | 
						record ComposeVersion(int major, int minor) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static final ComposeVersion UNKNOWN = new ComposeVersion(0, 0);
 | 
							static final ComposeVersion UNKNOWN = new ComposeVersion(0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		boolean isLessThan(int major, int minor) {
 | 
							boolean isLessThan(int major, int minor) {
 | 
				
			||||||
			return major() < major || major() == major && minor() < minor;
 | 
								return major() < major || major() == major && minor() < minor;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -371,7 +371,7 @@ NOTE: Using a javadoc:org.springframework.boot.testcontainers.service.connection
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[features.dev-services.testcontainers.at-development-time.importing-container-declarations]]
 | 
					[[features.dev-services.testcontainers.at-development-time.importing-container-declarations]]
 | 
				
			||||||
==== Importing Testcontainer Declaration Classes
 | 
					==== Importing Testcontainers Declaration Classes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A common pattern when using Testcontainers is to declare javadoc:org.testcontainers.containers.Container[] instances as static fields.
 | 
					A common pattern when using Testcontainers is to declare javadoc:org.testcontainers.containers.Container[] instances as static fields.
 | 
				
			||||||
Often these fields are defined directly on the test class.
 | 
					Often these fields are defined directly on the test class.
 | 
				
			||||||
| 
						 | 
					@ -396,7 +396,7 @@ You can also add javadoc:org.springframework.test.context.DynamicPropertySource[
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When using devtools, you can annotate beans and bean methods with javadoc:org.springframework.boot.devtools.restart.RestartScope[format=annotation].
 | 
					When using devtools, you can annotate beans and bean methods with javadoc:org.springframework.boot.devtools.restart.RestartScope[format=annotation].
 | 
				
			||||||
Such beans won't be recreated when the devtools restart the application.
 | 
					Such beans won't be recreated when the devtools restart the application.
 | 
				
			||||||
This is especially useful for Testcontainer javadoc:org.testcontainers.containers.Container[] beans, as they keep their state despite the application restart.
 | 
					This is especially useful for javadoc:org.testcontainers.containers.Container[] beans, as they keep their state despite the application restart.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
include-code::MyContainersConfiguration[]
 | 
					include-code::MyContainersConfiguration[]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ import org.springframework.context.ApplicationContext;
 | 
				
			||||||
import org.springframework.context.annotation.Import;
 | 
					import org.springframework.context.annotation.Import;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Imports idiomatic Testcontainer declaration classes into the Spring
 | 
					 * Imports idiomatic Testcontainers declaration classes into the Spring
 | 
				
			||||||
 * {@link ApplicationContext}. The following elements will be considered from the imported
 | 
					 * {@link ApplicationContext}. The following elements will be considered from the imported
 | 
				
			||||||
 * classes:
 | 
					 * classes:
 | 
				
			||||||
 * <ul>
 | 
					 * <ul>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,13 +45,13 @@ class DebugLogbackConfigurator extends LogbackConfigurator {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void appender(String name, Appender<?> appender) {
 | 
						void appender(String name, Appender<?> appender) {
 | 
				
			||||||
		info("Adding appender '" + appender + "' named '" + name + "'");
 | 
							info("Adding appender '" + appender + "' named '" + name + "'");
 | 
				
			||||||
		super.appender(name, appender);
 | 
							super.appender(name, appender);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void logger(String name, Level level, boolean additive, Appender<ILoggingEvent> appender) {
 | 
						void logger(String name, Level level, boolean additive, Appender<ILoggingEvent> appender) {
 | 
				
			||||||
		info("Configuring logger '" + name + "' with level '" + level + "'. Additive: " + additive);
 | 
							info("Configuring logger '" + name + "' with level '" + level + "'. Additive: " + additive);
 | 
				
			||||||
		if (appender != null) {
 | 
							if (appender != null) {
 | 
				
			||||||
			info("Adding appender '" + appender + "' to logger '" + name + "'");
 | 
								info("Adding appender '" + appender + "' to logger '" + name + "'");
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,7 @@ class DebugLogbackConfigurator extends LogbackConfigurator {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void start(LifeCycle lifeCycle) {
 | 
						void start(LifeCycle lifeCycle) {
 | 
				
			||||||
		info("Starting '" + lifeCycle + "'");
 | 
							info("Starting '" + lifeCycle + "'");
 | 
				
			||||||
		super.start(lifeCycle);
 | 
							super.start(lifeCycle);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue