日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內(nèi)最全IT社區(qū)平臺 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁 > php開源 > php教程 > 06_MyBatis,Spring,SpringMVC整合

06_MyBatis,Spring,SpringMVC整合

來源:程序員人生   發(fā)布時間:2015-01-28 09:05:25 閱讀次數(shù):4091次

  1. 項目結(jié)構(gòu)

  1. Spring的配置:

beans.xml

<?xml version="1.0" encoding="UTF⑻"?>

<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:context="http://www.springframework.org/schema/context"

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

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

    xsi:schemaLocation="http://www.springframework.org/schema/beans

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

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

       http://www.springframework.org/schema/mvc/spring-mvc⑶.0.xsd

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

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

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

       http://www.springframework.org/schema/aop/spring-aop⑶.0.xsd

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

       http://www.springframework.org/schema/tx/spring-tx⑶.0.xsd ">                      

      

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

      

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

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

           <property name="url" value="jdbc:mysql://localhost:3306/mybatis"></property>

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

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

       </bean>

      

       <!--

           使用spring來管理sqlSessionFactory

        -->

       <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">

           <property name="configLocation" value="classpath:sqlMapConfig.xml"></property>

           <property name="dataSource" ref="dataSource"></property>

       </bean>

      

       <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

           <property name="dataSource" ref="dataSource"></property>

       </bean>

      

       <tx:advice id="txAdvice" transaction-manager="txManager">

           <tx:attributes>

              <tx:method name="save*" propagation="REQUIRED"/>

              <tx:method name="update*" propagation="REQUIRED"/>

              <tx:method name="delete*" propagation="REQUIRED"/>

              <tx:method name="select*" read-only="true"/>

           </tx:attributes>

       </tx:advice>

      

       <aop:config>

           <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.rl.service..*.*(..))"/>

       </aop:config>

</beans>

  1. springmvc.xml的配置內(nèi)容以下:

<?xml version="1.0" encoding="UTF⑻"?>

<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:context="http://www.springframework.org/schema/context"

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

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

    xsi:schemaLocation="http://www.springframework.org/schema/beans

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

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

       http://www.springframework.org/schema/mvc/spring-mvc⑶.0.xsd

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

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

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

       http://www.springframework.org/schema/aop/spring-aop⑶.0.xsd

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

       http://www.springframework.org/schema/tx/spring-tx⑶.0.xsd ">                       

      

       <context:component-scan base-package="com.rl.controller"/>

       <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

           <property name="prefix" value="/WEB-INF/jsp/"></property>

           <property name="suffix" value=".jsp"></property>

       </bean>

</beans>

  1. web.xml的配置內(nèi)容以下:

<?xml version="1.0" encoding="UTF⑻"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

    id="WebApp_ID" version="2.5">

   

    <listener>

       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

    </listener>

    <context-param>

       <param-name>contextConfigLocation</param-name>

       <param-value>classpath:beans.xml</param-value>

    </context-param>

   

    <servlet>

       <servlet-name>springmvc</servlet-name>

       <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

       <init-param>

           <param-name>contextConfigLocation</param-name>

           <param-value>classpath:springmvc.xml</param-value>

       </init-param>

    </servlet>

    <servlet-mapping>

       <servlet-name>springmvc</servlet-name>

       <url-pattern>*.do</url-pattern>

    </servlet-mapping>

   

    <filter>

        <filter-name>SpringCharacterEncodingFilter</filter-name>

        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

        <init-param>

生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機掃描二維碼進行捐贈
程序員人生

------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 午夜精品在线观看 | 性国产 | 日韩专区一区二区 | 久久亚州综合 | 成人免费在线电影 | 国产精品成人av | 日韩色区| 日韩一区二区三区高清 | 一区高清 | 成人国产在线视频 | 黄色片网站在线观看 | 久久精品国产一区二区三区 | 欧美日韩国产在线 | 毛片毛 | 最新的中文字幕 | 日韩精品一二三四 | 日韩特黄电影 | 久久久a| 日韩中文字幕网址 | 免费在线成人av | 91av电影在线观看 | 亚洲色图 欧美 | 欧美国产高清 | 99视频在线 | 精品少妇久久久久久888优播 | 亚洲乱码国产乱码精品精98午夜 | 波多野结衣国产 | 亚洲一区二区在线视频 | 谁有免费黄色网址 | 亚洲色图28p | 国产偷窥女厕所高清 | 久久tv| 国产真实乱偷精品视频免 | 亚洲毛片免费观看 | 国产精品久久久久久久 | 亚洲综合免费 | 天天操天天射天天添 | a一级黄色大片 | 免费国产一区二区 | 精品人伦一区二区三区蜜桃网站 | avtt在线播放|