如何将下面给定的XML bean转换为java bean,同样的示例将不胜感激

时间:2019-03-29 07:05:32

标签: spring spring-boot spring-mvc endeca

我想从下面提供的XML bean中用java创建一个bean。它是用于endeca发现服务的bean

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

1 个答案:

答案 0 :(得分:0)

最后,我找到了方法

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

}

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