admin管理员组文章数量:1401959
I want to use in the main module A the classes of another module B. In module B I have a package crud.base. It has a subpackage service (crud.base.service) and a class ServiceB, which @Autowired the class RepositoryB from the package crud.base.repository. When I @Autowired class ServiceB into module A, I get an error:
Field repository in crud.base.service.ServiceB required a bean of type 'crud.base.repository.RepositoryB' that could not be found. Consider defining a bean of type 'crud.base.repository.RepositoryB' in your configuration.
I used this tutorial to import module B into module A Spring Boot Autowiring From Another Module
This worked, but without @Autowired RepositoryB. I would like the constructor with the @Autowired RepositoryB parameter to work in ServiceB, and I could use it in module A. Or in ServiceB I had a private field @Autowired RepositoryB. How to do this?
本文标签:
版权声明:本文标题:autowired - Spring Boot Autowiring From Another Module, problem with another module's bean - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744292035a2599161.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论