zonkyio / embedded-database-spring-test

A library for creating isolated embedded databases for Spring-powered integration tests.
Apache License 2.0
399 stars 37 forks source link

Spring Boot 3.1 Support #249

Closed Wallman closed 9 months ago

Wallman commented 9 months ago

Would love to see support for Spring Boot 3.1. Or is there support already?

tomix26 commented 9 months ago

Spring Boot 3.1 should be already supported. Are you facing any issues?

Wallman commented 9 months ago

That would be great! Then this would need a small update :)

I am, but not sure if they are caused by this lib!

tomix26 commented 9 months ago

Ok, thanks for letting me know, I’ll update it.

vladimirfx commented 9 months ago

It would be nice to support Spring Boot 3.2 / Framework 6.1. For this the new release of this module is needed because of compilation with parameters is required now. See https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x Core part.

rubengees commented 9 months ago

Hi everyone, I would also like to ask for Spring Boot 3.2 support. After upgrading from 3.1.6 to 3.2.0 the application context does not start anymore with this exception (only the relevant part):

java.lang.IllegalStateException: Failed to load ApplicationContext for [my context]
....
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.zonky.test.db.context.DefaultDatabaseContext]: Constructor threw exception
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:223)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:111)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:319)
    ... 114 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dockerPostgresDatabaseProvider' defined in class path resource [io/zonky/test/db/config/EmbeddedDatabaseAutoConfiguration.class]: Unsatisfied dependency expressed through method 'dockerPostgresDatabaseProvider' parameter 0: No qualifying bean of type 'io.zonky.test.db.config.DatabaseProviderFactory' available: expected single matching bean but found 8: postgresDatabaseProviderFactory,msSqlDatabaseProviderFactory,mySqlDatabaseProviderFactory,mariaDbDatabaseProviderFactory,h2DatabaseProviderFactory,hsqlDatabaseProviderFactory,derbyDatabaseProviderFactory,defaultDatabaseProviderFactory
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:802)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:546)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1166)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
    at io.zonky.test.db.support.DatabaseProviders.lambda$new$0(DatabaseProviders.java:46)
    at io.zonky.test.db.support.DatabaseProviders.getProvider(DatabaseProviders.java:65)
    at io.zonky.test.db.EmbeddedDatabaseContextCustomizerFactory$EmbeddedDatabaseRegistrar.lambda$postProcessBeanDefinitionRegistry$0(EmbeddedDatabaseContextCustomizerFactory.java:305)
    at io.zonky.test.db.context.DefaultDatabaseContext.<init>(DefaultDatabaseContext.java:85)
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:210)
    ... 116 more
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'io.zonky.test.db.config.DatabaseProviderFactory' available: expected single matching bean but found 8: postgresDatabaseProviderFactory,msSqlDatabaseProviderFactory,mySqlDatabaseProviderFactory,mariaDbDatabaseProviderFactory,h2DatabaseProviderFactory,hsqlDatabaseProviderFactory,derbyDatabaseProviderFactory,defaultDatabaseProviderFactory
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique(DependencyDescriptor.java:218)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1418)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1348)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
    ... 133 more

Using the latest version: 2.3.0. Thanks for looking!

vladimirfx commented 9 months ago

Fix already in tree. Waiting for release.

tomix26 commented 9 months ago

The new release is now available. I've also updated the readme. I'm closing this issue as the discussion has diverged significantly from the original question. Feel free to open a new one if the problem persists.

vladimirfx commented 9 months ago

Thank you a lot!