Hi, I’m doing a migration from spring boot 3.0.8 => 3.1.1. During the migration, the hibernate revisionlisner, which used to work well, did not inject the bean, so spring boot is not coming up. Even after googling, no one had the same issue as me, so I registered as an issue. Below is the log.
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
ERROR 23-07-07 10:59:41[restartedMain] [SpringApplication:824] - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Could not instantiate managed bean directly : com.bcg.funble.core.common.CustomRevisionListener
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:931)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:436)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
at com.bcg.funble.userapi.UserApiApplicationKt.main(UserApiApplication.kt:38)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
Caused by: org.hibernate.InstantiationException: Could not instantiate managed bean directly : com.bcg.funble.core.common.CustomRevisionListener
at org.hibernate.resource.beans.internal.FallbackBeanInstanceProducer.produceBeanInstance(FallbackBeanInstanceProducer.java:46)
at org.hibernate.envers.internal.revisioninfo.DefaultRevisionInfoGenerator.resolveRevisionListenerBean(DefaultRevisionInfoGenerator.java:115)
at org.hibernate.envers.internal.revisioninfo.DefaultRevisionInfoGenerator.<init>(DefaultRevisionInfoGenerator.java:50)
at org.hibernate.envers.configuration.internal.RevisionInfoConfiguration$RevisionEntityResolver.locateRevisionEntityMapping(RevisionInfoConfiguration.java:379)
at org.hibernate.envers.configuration.internal.RevisionInfoConfiguration$RevisionEntityResolver.<init>(RevisionInfoConfiguration.java:295)
at org.hibernate.envers.configuration.internal.RevisionInfoConfiguration.<init>(RevisionInfoConfiguration.java:86)
at org.hibernate.envers.configuration.Configuration.<init>(Configuration.java:192)
at org.hibernate.envers.boot.internal.EnversServiceImpl.initialize(EnversServiceImpl.java:104)
at org.hibernate.envers.boot.internal.AdditionalMappingContributorImpl.contribute(AdditionalMappingContributorImpl.java:50)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.lambda$processAdditionalMappingContributions$0(MetadataBuildingProcess.java:380)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.processAdditionalMappingContributions(MetadataBuildingProcess.java:377)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:335)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1380)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1451)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1816)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766)
... 21 common frames omitted
Caused by: java.lang.NoSuchMethodException: com.bcg.funble.core.common.CustomRevisionListener.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3585)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2754)
at org.hibernate.resource.beans.internal.FallbackBeanInstanceProducer.produceBeanInstance(FallbackBeanInstanceProducer.java:41)
... 43 common frames omitted
Process finished with exit code 0
Thank you for checking.