@SpringBootApplication
@EnableJpaRepositories(basePackages=..,entityManagerRef=..)
@ComponentScan("com.main", "com.external.jar")
public class Application{
...
//methods defining primary datasource, transaction manager, entityManagerFactoryBean
}
External Jar
@Configuration
@EnableJpaRepositories(basePackages="com.external.model", entityManagerRef=.., transactionManager=..)
public class ExternalDataConfig{
//methods defining datasource, transaction manager, entityManagerFactoryBean
}
public DataRepository extends CrudRepository<T,ID>{}
@Service
public class ExternalService{
@Autowire
private DataRepository externalRepository;
}
ошибка Field externalRepository in com.external.jar.ExternalService required a bean of type DataRepository'
Однако журналы указывают на успешное сканирование как стандартных, так и внешних репозиториев, но не уверены, почему механизм внедрения зависимостей не может найти боб
.s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
.s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
.s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 55ms. Found 3 JPA repository interfaces.
.s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
.s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
.s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 75ms. Found 21 JPA repository interfaces.