Hibernate 5.0.11 - AttributeConverter class registered multiple times

后端 未结 1 575
情书的邮戳
情书的邮戳 2020-12-20 23:37

I upgraded Spring Boot to 1.4.2 and Hibernate to 5.0.11.Final and started seeing this error. Not sure why HibernateJpaAutoConfiguration is registering the custo

相关标签:
1条回答
  • 2020-12-21 00:20

    Somehow the @EnableAutoconfiguration of JPA were passing two paths to get scanned, because the database configuration was in sub folder which makes sense.

    com.testOrg
    
    com.testOrg.configuration
    

    org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager on line 520 is adding converters multiple times based on the number of scanned configuration paths found, I think for other classes we do not have check for duplicacy but for Converters we do have check if it gets registered multiple times than throw Exception see. com.testOrg.configuration.MetadataBuilderImpl.java line 907

    To solve this, I moved my DatabaseConfiguration class out of "com.testOrg.configuration" folder to main and hence only one class to register.

    I hope this might be helpful for someone.

    0 讨论(0)
提交回复
热议问题