BeanCreationException in spring 6 and beans created without proxy

  Kiến thức lập trình

Has anyone seen this exception and may have some clue how to fix it?
When I turn on spring bean debug logging, there are thousands of logged exceptions like below:

2024-06-06T21:17:46.221Z [main] DEBUG [] DefaultListableBeanFactory : Creating shared instance of singleton bean ‘…’
2024-06-06T21:17:46.226Z [main] DEBUG [] DefaultListableBeanFactory : Creating shared instance of singleton bean ‘’
2024-06-06T21:17:46.227Z [main] DEBUG [] DefaultListableBeanFactory : Bean creation exception on singleton FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘$ChildAuthenticationManagerFactoryBean#1’: Cannot resolve reference to bean ‘authenticationManager’ while setting constructor argument

Since that exception is only logged at the debug level, is it considered non-fatal? (the beans did get created at that time).
However, when such exception occurs, the created beans have no association with proxy! And annotations like @Transactional on bean methods are not taking effect, so we have transaction related failures.

If I create a simple bean without any other beans referencing it, the bean is created with correct proxy:

If the bean is reference by our existing beans through autowire (@Autowired), the bean created is a concrete class instance without proxy:

I don’t have a simple code example to show the issue, but here are some info of the environment:
tomcat.version 10.1.20

spring.version 6.1.5

spring-security.version 6.2.3

hibernate.version 6.4.4.Final

Our beans are annotated with @Service or @Component.

The configuration related to “authenticationManager” bean and “authentication-manager-ref” defined in applicationContext-security.xml is like this:

     <beans:beans xmlns=""

    <security:authentication-manager alias="authenticationManager">
        <security:authentication-provider ref="myAuthenticationProvider"/>

    <http create-session="stateless" use-expressions="true" entry-point-ref="myEntryPoint" authentication-manager-ref="authenticationManager">
        <intercept-url pattern="/app/**" ... />
    <beans:bean id="myAuthenticationProvider" class="MyAuthenticationProvider"/>

Tried different way creating the beans. But it still looks like this exception is related to beans created without proxy association.