Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a prototype scoped bean in Groovy spring DSL

In grails one defines spring beans in resources.groovy using the spring groovy DSL

beans = {
    myBean(MyBeanImpl) {
        someProperty = 42
        otherProperty = "blue"
        bookService = ref("bookService")
    }
}

How do you define prototype scoped bean using this DSL? I couldnt find anything on this in the documentation

like image 610
mzzzzb Avatar asked Feb 10 '23 04:02

mzzzzb


1 Answers

This should work:

beans = {
    myBean(MyBeanImpl) { bean ->
        bean.scope = 'prototype'
        someProperty = 42
        otherProperty = "blue"
        bookService = ref("bookService")
    }
}
like image 82
Jeff Scott Brown Avatar answered Feb 13 '23 02:02

Jeff Scott Brown