Buffalo 2.0如何整合spring
小编给大家分享一下Buffalo 2.0如何整合spring,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
Spring是当前最流行的轻量级容器,Buffalo对它进行了支持。Spring中任意一个配置过的bean, 都可以通过简单的配置被暴露为buffalo服务。 以下简单介绍下Buffalo2.0集成Spring的配置。
1. web.xml配置:
<display-name>
Buffalo Web Remoting Demostration Application
display-name>
<context-param>
<param-name>contextConfigLocationparam-name>
<param-value>/WEB-INF/applicationContext.xmlparam-value>
context-param>
<servlet>
<servlet-name>bfappservlet-name>
<servlet-class>
net.buffalo.web.servlet.ApplicationServlet
servlet-class>
servlet>
<servlet>
<servlet-name>contextservlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
servlet-class>
<load-on-startup>1load-on-startup>
servlet>
<servlet-mapping>
<servlet-name>bfappservlet-name>
<url-pattern>/bfapp/*url-pattern>
servlet-mapping>
2. Spring的applicationContext.xml配置:
<bean id=" yourService "
class="xxx.service.yourService ">bean>
<bean name="buffaloConfigBean"
class="net.buffalo.service.BuffaloServiceConfigurer">
<property name="services">
<map>
<entry key="yourService">
<ref bean=" yourService " />
entry>