Skip to content

SqlSessionFactoryBean falls in circular dependencies by Spring Boot's DataSourceInitializer. #58

Open
@izeye

Description

@izeye

SqlSessionFactoryBean falls in circular dependencies by Spring Boot's DataSourceInitializer.

With @Lazy annotations it's okay but without them the following exception occurs:

Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?

A project with @Lazy annotations:
https://github.com/izeye/samples-spring-boot-branches/tree/mybatis-hsqldb

A project without @Lazy annotations:
https://github.com/izeye/samples-spring-boot-branches/tree/mybatis-hsqldb-without-lazy

I guess replacing ApplicationListener<ApplicationEvent> with ApplicationListener<ContextRefreshedEvent> would fix it.

If my usage is incorrect, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions