spring配置

<?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:jaxrs="http://cxf.apache.org/jaxrs"

xmlns:jaxws="http://cxf.apache.org/jaxws"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:util="http://www.springframework.org/schema/util"

xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd

http://cxf.apache.org/jaxrs

http://cxf.apache.org/schemas/jaxrs.xsd

http://cxf.apache.org/jaxws

http://cxf.apache.org/schemas/jaxws.xsd">


<context:property-placeholder />

<context:annotation-config />


<context:component-scan base-package=""></context:component-scan>

<!-- <util:properties id="iaasconfig" location="classpath:config.properties" /> -->

<jaxrs:server id="external" address="/rest">

<jaxrs:serviceBeans>

<bean class="com.mac.app.service.ApplyService"></bean>

</jaxrs:serviceBeans>

<jaxrs:providers>

<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />

</jaxrs:providers>

</jaxrs:server>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName" value="com.mysql.jdbc.Driver" />

<property name="url" value="jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&amp;characterEncoding=UTF-8" />

<property name="username" value="root" />

<property name="password" value="root" />

</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

<!-- 引用數據源 -->

  <property name="dataSource">

   <ref local="dataSource" />

  </property>

  <!-- 掃描實體類 -->

  <property name="packagesToScan">

   <list>

    <value>com.app.bean</value>

   </list>

  </property>

  <property name="hibernateProperties">

<props>

<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>

<prop key="hibernate.show_sql">false</prop>

<prop key="generate_statistics">true</prop>

<prop key="hibernate.hbm2ddl.auto">update</prop>

<prop key="hibernate.use_sql_comments">false</prop>

<prop key="hibernate.format_sql">true</prop>

</props>

  </property>

</bean>

</beans>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章