-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bean-based conditions do not consider factory beans correctly when determining if they are a candidate #42970
Comments
Hi @wilkinsona, Thanks for the fix. I have updated my sample to use snapshot and the earlier reported issue is fixed. But when schema validation is performed. spring boot default error
Am I missing any other configuration? |
Thanks for trying the snapshot and confirming that it fixes the earlier reported issue.
You need to use @EntityScan(basePackageClasses = Member.class) By default, the auto-configured entity manager will use the package of your |
Thanks @wilkinsona , It has worked. One of the side effects of using Spring boot extensively is that it does very good work by autoconfiguring we tend to forget basics. Feeling bit embarrassed on missing basic thing. Should we add in documentation about above basic |
Hi @wilkinsona , Is the bean based condition supported for In my It would be nice feature to support defaultCondidate =false for @TestConfiguration(proxyBeanMethods = false)
public class ContainersConfiguration {
@Qualifier("second") @Bean(defaultCandidate = false)
@ServiceConnection
MySQLContainer<?> mySQLContainer() {
return new MySQLContainer<>(DockerImageName.parse("mysql").withTag("9.1"));
}
@Bean
@ServiceConnection
PostgreSQLContainer<?> postgreSQLContainer() {
return new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("17.0-alpine"));
}
@Bean
public DynamicPropertyRegistrar databaseProperties(@Qualifier("second") MySQLContainer<?> mySQLContainer) {
return (properties) -> {
// Connect our Spring application to our Testcontainers instances
properties.add("app.datasource.cardholder.url", mySQLContainer::getJdbcUrl);
properties.add("app.datasource.cardholder.username", mySQLContainer::getUsername);
properties.add("app.datasource.cardholder.password", mySQLContainer::getPassword);
};
}
} |
I agree, and derived bean should also respect |
I created #42978, please verify if you get a chance @rajadilipkolli |
Not yet, no. I've opened #42979. Unfortunately, I don't think we can use quaff's approach and we should also consider the Docker compose side of things so that things are as conceptually similar as possible. |
I have a Spring Boot application that utilizes both Liquibase and Flyway for schema management, connecting to PostgreSQL and MySQL databases. I recently upgraded to Spring Boot 3.4.0-RC1 and it is working as expected with my code.
I have encountered below issue when attempting to simplify the configuration using the new approach as described in documentation.
Detailed logs can be seen in the github workflow here
Steps to Reproduce :
docker-compose.yml
Changes made to existing repository can be seen in this PR
Expected Behavior:
The application should start successfully using new approach and use Liquibase and Flyway to manage the schema for each database.
The text was updated successfully, but these errors were encountered: