gpt4 book ai didi

spring - GORMless Grails应用程序无法查找丢失的(和不必要的)transactionManager

转载 作者:行者123 更新时间:2023-12-02 15:33:43 26 4
gpt4 key购买 nike

当我的Grails 2.1应用试图使一个名为ServiceParamService的Grails服务实例化时,它的启动会随着下面的BeanCreationException而启动。我不奇怪没有找到一位交易经理,但我不明白为什么要寻找一位交易经理。

在调试器中四处寻找,似乎已经确定ServiceParamService是一种称为"TypeSpecifyableTransactionProxyFactoryBean"的东西,从本质上讲,它采用参数targetproxyTargetClasstransactionAttributeSourcetransactionManager

奇怪的是,该服务可以在另一个Grails应用程序中实例化得很好,该应用程序也没有定义事务管理器,并且具有相同的Config.groovyBuildConfig.groovyresources.xml。因此,以某种运气,愚蠢的运气,另一个应用程序解决了这个问题。除了不扔掉新应用程序(并通过删除旧应用程序的90%重新开始)之外,我如何才能弄清楚旧应用程序在做什么,以解决这个虚假的交易管理器要求?和/或自己解决它?

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceParamService': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:130)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 38 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:269)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 49 more

最佳答案

默认情况下,服务是事务性的。加

static transactional = false

到您的服务类,以防止将其包装在事务代理中。

关于spring - GORMless Grails应用程序无法查找丢失的(和不必要的)transactionManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15168675/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com