Autowiring fails: Not an managed Type

前端 未结 13 2067
清酒与你
清酒与你 2020-12-02 12:30

I have a big problem in my diploma project and would be very glad if you guys could help me! I made a Maven Multi Module Project and have 3 \"Core-projects\"

  • <
13条回答
  •  时光取名叫无心
    2020-12-02 13:01

    Just in case some other poor sod ends up here because they are having the same issue I was: if you have multiple data sources and this is happening with the non-primary data source, then the problem might be with that config. The data source, entity manager factory, and transaction factory all need to be correctly configured, but also -- and this is what tripped me up -- MAKE SURE TO TIE THEM ALL TOGETHER! @EnableJpaRepositories (configuration class annotation) must include entityManagerFactoryRef and transactionManagerRef to pick up all the configuration!

    The example in this blog finally helped me see what I was missing, which (for quick reference) were the refs here:

    @EnableJpaRepositories(
        entityManagerFactoryRef = "barEntityManagerFactory",
        transactionManagerRef = "barTransactionManager",
        basePackages = "com.foobar.bar")
    

    Hope this helps save someone else from the struggle I've endured!

提交回复
热议问题