Я упаковал все сущности приложения и интерфейсы репозитория в одну банку. Репозитории написаны с аннотацией @Repository:
@Repository
public interface InternalUserRepository extends JpaRepository<InternalUser, Long>{
}
Я включил этот jar-файл в мое приложение весенней загрузки и пытаюсь выполнить автоматическое подключение интерфейса с контроллера:
@RestController
public class AuthenticationController {
@Autowired
AuthenticationService authenticationService;
@Autowired
InternalUserRepository internalUserRepository;
@GetMapping("/")
public String home() {
return "Hello World!";
}
}
Класс моего основного приложения написан так:
@SpringBootApplication
@EnableJpaRepositories
@ComponentScan("com.cdac.dao.cdacdao.*")
public class CdacAuthenticationMgntApplication {
public static void main(String[] args) {
SpringApplication.run(CdacAuthenticationMgntApplication.class, args);
}
}
Хранилище не подключается автоматически. Когда я запускаю приложение Spring boor, я получаю следующую ошибку:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field internalUserRepository in
com.cdac.user.cdacauthenticationmgnt.controller.AuthenticationController required a bean of type 'com.cdac.dao.cdacdao.repository.InternalUserRepository' that could not be found.
Action:
Consider defining a bean of type 'com.cdac.dao.cdacdao.repository.InternalUserRepository' in your configuration.
Кто-нибудь пробовал подобную архитектуру, подобную этой?