You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
graemerocher said:
in order to do circular references you have to implement InitializingBean as per the Spring recommendations. This is not a Grails bug, if you have further concerns raise in Spring JIRA
zergling_zzh said:
Why does grails not use lazy init on all reference to services and controllers? It will avoid circular references issue. Not all grails users are masters of Spring. It is really easy to get circular reference in big projects.
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)
The text was updated successfully, but these errors were encountered: