我得到了例外:
WELD-001408 Unsatisfied dependencies for type [EmbeddedCacheManager] with qualifiers [@Default] at injection point [[parameter 1] of [constructor] @Inject public org.jboss.jdf.example.ticketmonster.service.SeatAllocationService(EmbeddedCacheManager)].
有人有小费吗?我已经确认 beans.xml 在 src\main\webapp\WEB-INF 中,并且我不会发布多个 jar。这只是一个项目。
@Inject public SeatAllocationService(EmbeddedCacheManager manager) {
Configuration allocation = new ConfigurationBuilder()
.transaction()
.transactionMode(TransactionMode.TRANSACTIONAL)
.transactionManagerLookup(new JBossTransactionManagerLookup())
.lockingMode(LockingMode.PESSIMISTIC)
.loaders()
.addFileCacheStore()
.purgeOnStartup(true)
.build();
manager.defineConfiguration(ALLOCATIONS, allocation);
this.cache = manager.getCache(ALLOCATIONS);
}
POM 片段:
<dependencyManagement>
...
<artifactId>jboss-javaee-6.0-with-infinispan</artifactId>
...
</dependencyManagement>
<dependencies>
...
<artifactId>infinispan-core</artifactId>
...
</dependencies>