相关疑难解决方法(0)

使用@Autowired的@Transaction注释 - Spring

好吧,我有一个带@Service注释的类和一些奇怪的发生器:当我把注释@Transaction放在某些方法中我无法启动tomcat服务器时,我得到错误:"无法自动装配......"在另一个类中当我使用我的@Autowired,但当我删除@Transaction一切正常.

我的标题是:

@Service(value = "caixaBO")
public class CaixaBOImpl extends BasicBOImpl {
Run Code Online (Sandbox Code Playgroud)

我的方法签名是:

@Transactional(propagation = Propagation.REQUIRED)
public void movimentarCaixaPaciente(String descricao, double valor,
        Paciente paciente) {
Run Code Online (Sandbox Code Playgroud)

当我使用@Autowired CaixaBOImpl caixaBO时,由于注释@Transaction,我在tomcat初始化时出错.

编辑1:

1 - 我在applicationContext.xml中有transactionManager,看看:

<!-- Configuracao do gerente de transacoes do Spring -->
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>
Run Code Online (Sandbox Code Playgroud)

2 - 我在pom.xml中有CGLIB,看看:

<dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>2.2.2</version>
        </dependency>
Run Code Online (Sandbox Code Playgroud)

编辑2

我的堆栈跟踪:

Grave: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pedidoProteseBO': Injection of autowired …
Run Code Online (Sandbox Code Playgroud)

java spring

10
推荐指数
1
解决办法
8125
查看次数

标签 统计

java ×1

spring ×1