Groovy Bean configuration

Viewed 17

I have two beans, one of type scope request and the other is the factory to create Create a bean for each request from the first one. I did it with annotations and it works, however I need to create them with XML or with DSL and I haven't been able to do it. Any idea how to do it? I'm using Grails 2.5.6

These are the two Java Beans with annotations

@Configuration
public class HeadersConfiguration {

    @Bean
    public Function<HttpServletRequest, MelHeaders> headerHandlerFactory() {
        return { request -> melHeaders(request) };
    }

    @Bean
    @Scope(value = WebApplicationContext.SCOPE_REQUEST)
    public MelHeaders melHeaders(HttpServletRequest request) {
        return new MelHeaders(request);
    }
}

Thank's

0 Answers
Related