0
在我的Spring上下文我以下幾點:彈簧數據Envers庫未能注入
<jpa:repositories base-package="x.y.service.springDataJpa"/>
<jpa:repositories base-package="x.y.service.springDataEnvers"
factory-class="org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean" />
這應該拿起我的正常彈簧數據的JPA庫和我的彈簧數據envers庫。
但執行該JUnit的TestClass中時:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ApplicationTestContext.class, OrmContext.class, DatasourceContext.class})
@ActiveProfiles(profiles = "LOCAL")
@Transactional
public class StoreAndRetrieveRevisionTest {
@Inject
private ServiceRepository serviceRepository;
@Inject
private ServiceRevisionRepository serviceRevisionRepository;
(該ApplicationTestContext.class加載XML配置)。
它沒有注入revisionrepository豆:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'x.y.server.springDataJpa.hibernateenvers.StoreAndRetrieveRevisionTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private x.y.service.springDataEnvers.ServiceRevisionRepository x.y.server.springDataJpa.hibernateenvers.StoreAndRetrieveRevisionTest.serviceRevisionRepository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [x.y.service.springDataEnvers.ServiceRevisionRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
缺少什麼我在這裏? spring-data-envers文檔相當稀少..