I've got a problem from migrating from SB 2.3 to 2.5 branch.

When having a Database with Spring-jdbc in my java applications, CXF JAX-WS clients being initialized with XML config were stopped working since address being populated with the ${placeholder} instead of real value defined in properties.

For me, this is caused by DatabaseInitializationDependencyConfigurer. It gets all DependsOnDatabaseInitializationDetector and the AnnotationDependsOnDatabaseInitializationDetector is causing eagerInit called before properties are parsed.

 - org.springframework.boot.sql.init.dependency.AnnotationDependsOnDatabaseInitializationDetector.detect(ConfigurableListableBeanFactory)
 - org.springframework.beans.factory.ListableBeanFactory.findAnnotationOnBean(String beanName, Class<A> annotationType)
 - org.springframework.beans.factory.support.DefaultListableBeanFactory.findMergedAnnotationOnBean(String beanName, Class<A> annotationType)
 - org.springframework.beans.factory.support.AbstractBeanFactory.getType(String name)
 - org.springframework.beans.factory.support.AbstractBeanFactory.getType(String name, boolean allowFactoryBeanInit)

--> second param allowFactoryBeanInit is true here

Currently under Java 8 using SpringBoot 2.5.7.

Could you please provide a fix for this ?

Making XML Config to Java Config gives me a workaroung but not a real solution to fix this regression. Overring SpringBoot DatabaseInitializationDependencyConfigurer with empty class also fixes the problem.

I've managed to create a simple example of this issue, I'll send it very soon.

Thanks in advance

Comment From: laurentschoelens

demo-issue28977.zip Here is a working example to reproduce the issue with one project having Java Config (working) and another one having XML Config (fail)

When downgrading to SB 2.4 : both apps are working

Comment From: wilkinsona

This branch contains a fix for this issue. If spring-projects/spring-framework#27796 provides a method to find an annotation without initializing factory beans some of the changes will no longer be necessary.

Comment From: laurentschoelens

@wilkinsona : thanks, i'll wait 2.5.8 SB release to pick up the fix and delay my upgrade :)

Comment From: snicoll

@laurentschoelens thanks for the sample. I was able to build it with the latest change and it is working as expected now.

Comment From: laurentschoelens

Thanks @snicoll I've experienced issue creation last year with Spring Boot so I wanted no one to waste time and my bug to be cleared as possible. I look forward to update SB 2.5.8 now