Original Reporter: fjanon
Environment: Grails 1.1.1, WinXP
Version: 1.1.1
Migrated From: http://jira.grails.org/browse/GRAILS-5080
Not sure it's a bug or a feature of Spring. I thought it's worth looking into it and documenting it.
In the end, the question is: can we create the services with transactional = false and then change transactional = true when we need it in a service method?
I create a new project with only 2 services referencing each other. "run-app" fails with:
2009-09-08 16:00:22,782 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAService': Cannot create inner bean '(inner bean)' whil
e setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner b
ean)#3': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'se
rviceBService': Cannot create inner bean '(inner bean)' while setting bean property 'target'; nested exception is org.springframework.beans.factory.Be
anCreationException: Error creating bean with name '(inner bean)#3': Initialization of bean failed; nested exception is org.springframework.beans.fact
ory.BeanCurrentlyInCreationException: Error creating bean with name 'serviceAService': org.springframework.beans.factory.FactoryBeanNotInitializedExce
ption: FactoryBean is not fully initialized yet
I then change only ServiceAService:
boolean transactional = false
and "run-app" is happy.
class ServiceAService {
boolean transactional = false
def ServiceBService
def serviceMethod() {
println "ServiceAService serviceMethod"
}
}
class ServiceBService {
boolean transactional = true
def ServiceAService
def serviceMethod() {
println "ServiceBService serviceMethod"
}
}
Note that is transactional is true in ServiceA and false in ServiceB it fails (I guess because on the alphabetical order on creating services)
Original Reporter: fjanon
Environment: Grails 1.1.1, WinXP
Version: 1.1.1
Migrated From: http://jira.grails.org/browse/GRAILS-5080
Not sure it's a bug or a feature of Spring. I thought it's worth looking into it and documenting it.
In the end, the question is: can we create the services with transactional = false and then change transactional = true when we need it in a service method?
I create a new project with only 2 services referencing each other. "run-app" fails with:
2009-09-08 16:00:22,782 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAService': Cannot create inner bean '(inner bean)' whil
e setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner b
ean)#3': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'se
rviceBService': Cannot create inner bean '(inner bean)' while setting bean property 'target'; nested exception is org.springframework.beans.factory.Be
anCreationException: Error creating bean with name '(inner bean)#3': Initialization of bean failed; nested exception is org.springframework.beans.fact
ory.BeanCurrentlyInCreationException: Error creating bean with name 'serviceAService': org.springframework.beans.factory.FactoryBeanNotInitializedExce
ption: FactoryBean is not fully initialized yet
I then change only ServiceAService:
boolean transactional = false
and "run-app" is happy.
class ServiceAService {
}
class ServiceBService {
}
Note that is transactional is true in ServiceA and false in ServiceB it fails (I guess because on the alphabetical order on creating services)