Skip to content
Browse files

add lazyInit property to Services

  • Loading branch information...
1 parent 2048e21 commit 786a22c14714e5a311373dd7e20064ebe276fb33 @smaldini smaldini committed Sep 28, 2011
View
9 ...s/src/main/groovy/org/codehaus/groovy/grails/plugins/services/ServicesGrailsPlugin.groovy
@@ -50,9 +50,10 @@ class ServicesGrailsPlugin {
GrailsServiceClass serviceClass = serviceGrailsClass
def scope = serviceClass.getPropertyValue("scope")
+ def lazyInit = serviceClass.hasProperty("lazyInit") ? serviceClass.getPropertyValue("lazyInit") : true
"${serviceClass.fullName}ServiceClass"(MethodInvokingFactoryBean) { bean ->
- bean.lazyInit = true
+ bean.lazyInit = lazyInit
targetObject = ref("grailsApplication", true)
targetMethod = "getArtefact"
arguments = [ServiceArtefactHandler.TYPE, serviceClass.fullName]
@@ -72,9 +73,9 @@ class ServicesGrailsPlugin {
"${serviceClass.propertyName}"(TypeSpecifyableTransactionProxyFactoryBean, serviceClass.clazz) { bean ->
if (scope) bean.scope = scope
- bean.lazyInit = true
+ bean.lazyInit = lazyInit
target = { innerBean ->
- innerBean.lazyInit = true
+ innerBean.lazyInit = lazyInit
innerBean.factoryBean = "${serviceClass.fullName}ServiceClass"
innerBean.factoryMethod = "newInstance"
innerBean.autowire = "byName"
@@ -88,7 +89,7 @@ class ServicesGrailsPlugin {
else {
"${serviceClass.propertyName}"(serviceClass.getClazz()) { bean ->
bean.autowire = true
- bean.lazyInit = true
+ bean.lazyInit = lazyInit
if (scope) {
bean.scope = scope
}

3 comments on commit 786a22c

@burtbeckwith
grails member

This should be documented.

@pledbrook
grails member

In French too ;)

@smaldini
grails member

got it :)

Please sign in to comment.
Something went wrong with that request. Please try again.