【仅备忘用】spring的applicationContext.xml

来源:互联网 发布:mysql 缺省时间 编辑:程序博客网 时间:2024/06/02 01:58
<?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:mvc="http://www.springframework.org/schema/mvc"       xmlns:p="http://www.springframework.org/schema/websocket"       xmlns:tx="http://www.springframework.org/schema/tx"       xmlns:task="http://www.springframework.org/schema/task"       xmlns:context="http://www.springframework.org/schema/context"       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket.xsd    http://www.springframework.org/schema/context        http://www.springframework.org/schema/context/spring-context.xsd         http://www.springframework.org/schema/tx        http://www.springframework.org/schema/tx/spring-tx.xsd        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> <!--  <context:component-scan base-package="cn.paic.rep.pare">     <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan> -->  <!-- jndi方式取数据库 -->    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">        <property name="jndiName" value="xds-pg" />        <property name="resourceRef" value="true" />        <property name="expectedType" value="javax.sql.DataSource" />    </bean>    <!-- classpath of pro and test environment is ${tomcat_home}/config -->     <bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">        <property name="locations">            <list>                <value>classpath:relation.properties</value>                <value>classpath:mail-config.properties</value>                <value>classpath:admin.properties</value>            </list>        </property>    </bean>    <!--  配置hibernate SessionFactory-->    <bean id="sessionFactory"          class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">        <property name="dataSource" ref="dataSource" />        <property name="hibernateProperties">            <props>                <prop key="hibernate.connection.driver_class">org.postgresql.Driver</prop>                <prop key="hibernate.dialect">                    org.hibernate.dialect.PostgreSQL81Dialect                </prop>                <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQL82Dialect</prop>                <prop key="hibernate.show_sql">true</prop>                <prop key="hiberante.format_sql">true</prop>                <prop key="hiberante.connection.autocommit">true</prop>                <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>            </props>        </property>        <property name="annotatedClasses">            <list>                <value>a.b.c.XXX</value>            </list>        </property>    </bean>    <tx:annotation-driven transaction-manager="transactionManager"/>    <!-- 事务管理器 -->    <bean id="transactionManager"          class="org.springframework.orm.hibernate4.HibernateTransactionManager">        <property name="sessionFactory" ref="sessionFactory"></property>    </bean>    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate">        <property name="sessionFactory" ref="sessionFactory"></property>    </bean></beans>
0 0
原创粉丝点击