How to convert the below given XML bean into java bean, example for the same will be appreciated

54 views Asked by At

I want to create a bean in java from the below-provided XML bean. It is a bean used for endeca discovery services

<bean id="httpServletRequest" scope="request"
          factory-bean="springUtility"
          factory-method="getHttpServletRequest" />
1

There are 1 answers

0
Aman Vyas On

Finally, I found how to do it

@Bean
@Scope("singleton")
public SpringUtility springUtility()
{
    return new SpringUtility();

}

@Bean
@Scope("request")
public HttpServletRequest getHttpServletRequest()
{
    return springUtility().getHttpServletRequest();
}