Merge branch '2.5.x'
This commit is contained in:
@@ -22,10 +22,10 @@ import javax.sql.DataSource;
|
||||
import io.rsocket.transport.ClientTransport;
|
||||
import io.rsocket.transport.netty.client.TcpClientTransport;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration.IntegrationComponentScanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
|
||||
@@ -49,10 +49,8 @@ import org.springframework.integration.annotation.IntegrationComponentScan;
|
||||
import org.springframework.integration.annotation.MessagingGateway;
|
||||
import org.springframework.integration.config.IntegrationManagementConfigurer;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.endpoint.MessageProcessorMessageSource;
|
||||
import org.springframework.integration.gateway.RequestReplyExchanger;
|
||||
import org.springframework.integration.handler.MessageProcessor;
|
||||
import org.springframework.integration.rsocket.ClientRSocketConnector;
|
||||
import org.springframework.integration.rsocket.IntegrationRSocketEndpoint;
|
||||
import org.springframework.integration.rsocket.ServerRSocketConnector;
|
||||
@@ -170,6 +168,27 @@ class IntegrationAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenIntegrationJdbcDataSourceInitializerIsEnabledThenFlywayCanBeUsed() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withConfiguration(AutoConfigurations.of(DataSourceTransactionManagerAutoConfiguration.class,
|
||||
JdbcTemplateAutoConfiguration.class, IntegrationAutoConfiguration.class,
|
||||
FlywayAutoConfiguration.class))
|
||||
.withPropertyValues("spring.datasource.generate-unique-name=true",
|
||||
"spring.integration.jdbc.initialize-schema=always")
|
||||
.run((context) -> {
|
||||
IntegrationProperties properties = context.getBean(IntegrationProperties.class);
|
||||
assertThat(properties.getJdbc().getInitializeSchema())
|
||||
.isEqualTo(DataSourceInitializationMode.ALWAYS);
|
||||
JdbcOperations jdbc = context.getBean(JdbcOperations.class);
|
||||
assertThat(jdbc.queryForList("select * from INT_MESSAGE")).isEmpty();
|
||||
assertThat(jdbc.queryForList("select * from INT_GROUP_TO_MESSAGE")).isEmpty();
|
||||
assertThat(jdbc.queryForList("select * from INT_MESSAGE_GROUP")).isEmpty();
|
||||
assertThat(jdbc.queryForList("select * from INT_LOCK")).isEmpty();
|
||||
assertThat(jdbc.queryForList("select * from INT_CHANNEL_MESSAGE")).isEmpty();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void integrationJdbcDataSourceInitializerDisabled() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
@@ -398,8 +417,9 @@ class IntegrationAutoConfigurationTests {
|
||||
static class MessageSourceConfiguration {
|
||||
|
||||
@Bean
|
||||
MessageSource<?> myMessageSource() {
|
||||
return new MessageProcessorMessageSource(mock(MessageProcessor.class));
|
||||
org.springframework.integration.core.MessageSource<?> myMessageSource() {
|
||||
return new MessageProcessorMessageSource(
|
||||
mock(org.springframework.integration.handler.MessageProcessor.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -412,7 +432,7 @@ class IntegrationAutoConfigurationTests {
|
||||
return new IntegrationRSocketEndpoint() {
|
||||
|
||||
@Override
|
||||
public Mono<Void> handleMessage(Message<?> message) {
|
||||
public reactor.core.publisher.Mono<Void> handleMessage(Message<?> message) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.boot.sql.init.dependency.AbstractBeansOfTypeDatabaseInitializerDetector;
|
||||
import org.springframework.boot.sql.init.dependency.DatabaseInitializerDetector;
|
||||
import org.springframework.core.Ordered;
|
||||
|
||||
/**
|
||||
* A {@link DatabaseInitializerDetector} for {@link AbstractDataSourceInitializer}.
|
||||
@@ -30,9 +31,16 @@ import org.springframework.boot.sql.init.dependency.DatabaseInitializerDetector;
|
||||
@Deprecated
|
||||
class AbstractDataSourceInitializerDatabaseInitializerDetector extends AbstractBeansOfTypeDatabaseInitializerDetector {
|
||||
|
||||
private static final int PRECEDENCE = Ordered.LOWEST_PRECEDENCE - 100;
|
||||
|
||||
@Override
|
||||
protected Set<Class<?>> getDatabaseInitializerBeanTypes() {
|
||||
return Collections.singleton(AbstractDataSourceInitializer.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return PRECEDENCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user