【发布时间】:2019-07-20 06:21:53
【问题描述】:
有没有办法在EJB 中的一个“地方”配置事务?我知道我可以使用@TransactionManagement,但它需要将此注释添加到每个bean,默认事务属性是REQUIRED。我想要实现的是在整个项目中禁用事务。我尝试使用@Stereotype 创建自定义注释,但它不能与@Singleton 一起使用。那么就会出现这个错误:
[2019-07-20T08:17:31.918+0200] [Payara 5.191] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=172 _ThreadName=admin-thread-pool::admin-listener(5)] [timeMillis: 1563603451918] [levelValue: 1000] [[
Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI definition failure:WELD-001508: Cannot create an InjectionTarget from [EnhancedAnnotatedTypeImpl] public abstract interface @Stereotype @Singleton @Target @TransactionAttribute @Retention class pl.orangelabs.hod.app.config.NoTransactionComponent as it is an int
erface -- WELD-001508: Cannot create an InjectionTarget from [EnhancedAnnotatedTypeImpl] public abstract interface @Stereotype @Singleton @Target @TransactionAttribute @Retention class pl.orangelabs.hod.app.config.NoTransactionComponent as it is an interface
at org.jboss.weld.util.InjectionTargets.createNonProducibleInjectionTarget(InjectionTargets.java:82)
at org.jboss.weld.util.InjectionTargets.createNonProducibleInjectionTarget(InjectionTargets.java:48)
at org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:126)
at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:88)
我正在使用Payara server 来部署应用程序。
【问题讨论】:
标签: java jakarta-ee transactions ejb payara