Groovy Spring DSL Constructor Argument

I have been trying to create an inner class instance of a Spring constructor argument and have been looking at the Grails documentation that states

Constructor arguments can be defined using parameters to each method that reside between the class of the bean and the last closure: (from http://www.grails.org/Spring+Bean+Builder)

bb.beans {
   exampleBean(MyExampleBean, "firstArgument", 2) {
       someProperty = [1,2,3]
   }
}


For the life of me, I can not understand what this sentence actually means.

What I was able to get to work was this

    routingLookupHttpSender(org.springframework.ws.transport.http.CommonsHttpMessageSender,
            ref("httpClient")) {
        httpClient(org.apache.commons.httpclient.HttpClient) {
            params = ref(
                httpParams(org.apache.commons.httpclient.params.HttpClientParams) {
                    // Timeout in milliseconds: in this case 2 minutes (120 000)
                    soTimeout = ConfigurationHolder.config.routingLookupService.timeout
                }
            )
        }
    }

Basically creating a httpClient inner class inside my outer class enclosure and just used the ref(“httpClient”) which refers to the inner scoped name.

VN:F [1.9.1_1087]
Rating: 9.5/10 (2 votes cast)
VN:F [1.9.1_1087]
Rating: 0 (from 2 votes)
Groovy Spring DSL Constructor Argument, 9.5 out of 10 based on 2 ratings
  • Share/Bookmark

This entry was posted on Friday, April 9th, 2010 at 10:25 am and is filed under Grails-Groovy, Java-JavaEE-J2EE, Springframework. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Groovy Spring DSL Constructor Argument”

  1. Tweets that mention Groovy Spring DSL Constructor Argument: I have been trying to create an inner class instance of a Spring construct... -- Topsy.com Says:

    [...] This post was mentioned on Twitter by Mick Knutson. Mick Knutson said: Groovy Spring DSL Constructor Argument: I have been trying to create an inner class instance of a Spring construct… http://bit.ly/cyfzpV [...]

Leave a Reply

You must be logged in to post a comment.