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?

本文标签: