我試圖讓Spring數據JPA與EJB和CDI(Java EE 7)一起工作。 那麼,我遵循文檔(http://docs.spring.io/spring-data/jpa/docs/1.4.2.RELEASE/reference/html/jpa.repositories.html#jpd.misc.cdi-integration),但仍然無法@注入我的存儲庫在無狀態的ejb。 這裏是代碼:無法在Java EE 7堆棧上獲得Spring Data JPA + CDI
@Configuration
@EnableJpaRepositories
public class EntityManagerFactoryProducer {
@Produces
@ApplicationScoped
public EntityManagerFactory entityManagerFactory() {
return Persistence.createEntityManagerFactory("mypu");
}
public void close(@Disposes EntityManagerFactory entityManagerFactory) {
entityManagerFactory.close();
}
}
$
public interface TipoFolhaRepository extends JpaRepository<TipoFolha, Long> {
List<TipoFolha> findByNome(String nome);
TipoFolha findByTipo(String tipo);
}
$
@Stateless
public class TipoFolhaFacade extends AbstractFacade<TipoFolha> {
@Inject
TipoFolhaRepository tpRepo;
@Override
public List<TipoFolha> findAll(){
return tpRepo.findAll();
}
}
跟隨誤差。 WELD-001408類型[TipoFolhaRepository]帶有限定符[@Default]在注入點[[BackedAnnotatedField] @Inject com.mycompany.ejb.TipoFolhaFacade.tpRepo]的不滿意依存關係
我失蹤了嗎? = S
嗨發現,你設法找到一個解決方案?你可以發佈嗎? – ieugen