<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<bean id="dataSource" destroy-method="close" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="minPoolSize" > <value >5 </value > </property >
<property name="maxPoolSize" > <value >100 </value > </property >
<property name="initialPoolSize"><value>10</value></property>
<property name="maxIdleTime" > <value >60 </value > </property >
<property name="acquireIncrement" > <value >5</value > </property >
<property name="acquireRetryAttempts" > <value >30 </value > </property >
<property name="acquireRetryDelay" > <value >1000 </value > </property >
<property name="maxStatements" > <value >0 </value > </property >
<property name="breakAfterAcquireFailure"><value>true</value></property>
<property name="idleConnectionTestPeriod" > <value >60 </value > </property >
<property name="testConnectionOnCheckout" > <value >true </value > </property >
<property name="testConnectionOnCheckin" > <value >true </value > </property >
<property name="autoCommitOnClose" > <value >false </value > </property >
<property name="checkoutTimeout" > <value >6000 </value > </property >
<property name="connectionTesterClassName" > <value >com.mchange.v2.c3p0.impl.DefaultConnectionTester</value > </property >
</bean>
<!-- 整合hibernate的配置 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.hbmop.app.model</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
<!-- org.hibernate.dialect.MySQLDialect -->
org.hibernate.dialect.MySQL5InnoDBDialect
</prop>
<!-- 是否显示HQL执行语句 -->
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.connection.autoReconnect">true</prop>
<prop key="hibernate.connection.autoReconnectForPools">true</prop>
<prop key="current_session_context_class">thread</prop>
</props>
</property>
<!-- O/R MappingResources -->
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory">
</property>
</bean>
<!-- 声明式事务管理 -->
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!--配置bean,配置后该类由spring管理-->
<bean id="buildingWebService" class="com.hbmop.app.webservice.BuildingWebSerImpl">
<property name="buildingService" ref="buildingService"></property>
</bean>
<bean id="buildingService" class="com.hbmop.app.serviceImpl.BuildingServicImpl">
<property name="bDAO" ref="buildingDAO"></property>
</bean>
<bean id="buildingDAO" class="com.hbmop.app.dao.BuildingDAO"></bean>
<jaxws:endpoint id="greetingService"
implementor="com.demo.GreetingServiceimpl"
address="/GreetingService" />
<jaxws:endpoint id="buildingService1"
implementor="#buildingWebService"
address="/BuildingService" />
</beans>
当需要将bean注入到webservice接口实现类时,如果该bean已经在application.xml中声明
<bean id="buildingWebService" class="com.hbmop.app.webservice.BuildingWebSerImpl">
那么在注入时,需要将bean的id注入时加#
<jaxws:endpoint id="buildingService1"
implementor="#buildingWebService"
address="/BuildingService" />