java - Spring 4 / Groovy DSL - autowiring -


how enable autowiring when using groovy dsl in spring 4?

if config.groovy file looks this:

beans {     mongoclient(com.mongodb.mongoclient)      hello(org.abiri.helloimpl) {         mongoclient = mongoclient     } } 

previously in xml configuration, have done this:

<bean id="hello" class="org.abiri.helloimpl" autowire="bytype" /> 

and enable whole file:

<beans default-autowire="bytype" /> 

what equivalent of xml snippets in new groovy dsl, i.e need in order mongoclient autowired hello ?

you need use

hello(org.abiri.helloimpl) { bean ->   bean.autowire = "bytype" } 

the configuration closure passed parameter can use configure things attributes on bean element in xml configuration. in addition autowire includes scope, initmethod , destroymethod.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -