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.

Mick Knutson

Java, JavaEE, J2EE, WebLogic, WebSphere, JBoss, Tomcat, Oracle, Spring, Maven, Architecture, Design, Mentoring, Instructor and Agile Consulting. http://www.baselogic.com/blog/resume

View all posts

Java / JavaEE / Spring Boot Channel

BLiNC Supporters

BLiNC Adsense

Archives

Newsletter