ssm applicationContent.xml

來源:互聯網
上載者:User

標籤:bsp   method   basic   data   utf-8   nal   factor   beans   http   

 1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 4     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" 5     xmlns:mvc="http://www.springframework.org/schema/mvc" 6     xsi:schemaLocation=" 7         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 8         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 9         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd10         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd11            http://www.springframework.org/schema/mvc12        http://www.springframework.org/schema/mvc/spring-mvc.xsd">13 14 15      <mvc:annotation-driven />  16     <!-- 開啟掃描,掃描所有的設定檔,以Controller註解的除外 -->17     <context:component-scan base-package="com.jlncrm">18     </context:component-scan>19 20     <!-- 以下是Spring MVC + Spring的全註解配置 -->21 22     <!-- Spring MVC 的所有配置 -->23     <bean24         class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />25     <bean26         class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />27 28     <mvc:default-servlet-handler />29         <!-- 靜態資源處理 -->30     <mvc:resources mapping="/static/**" location="/WEB-INF/static/" />31 32     <!-- 預設的視圖解析器 在上邊的解析錯誤時使用 (預設使用html)- -->33     <bean id="defaultViewResolver"34         class="org.springframework.web.servlet.view.InternalResourceViewResolver">35         <property name="viewClass"36             value="org.springframework.web.servlet.view.JstlView" />37         <property name="contentType" value="text/html" />38         <property name="prefix" value="/WEB-INF/jsp/" />39         <property name="suffix" value=".jsp" />40     </bean>41 42     <!-- 以下是Spring + Mybatis的全註解配置 -->43 44     <tx:annotation-driven transaction-manager="txManager" />45 46     <!-- 註冊交易管理 -->47     <bean id="txManager"48         class="org.springframework.jdbc.datasource.DataSourceTransactionManager">49         <property name="dataSource" ref="dataSource" />50     </bean>51 52     <!-- 定義dbcp資料來源 -->53     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">54         <!-- 指定JDBC驅動類 -->55         <property name="driverClassName" value="com.mysql.jdbc.Driver">56         </property>57         <!-- 提供串連資料庫的URL地址 -->58         <property name="url" value="jdbc:mysql://localhost:3306/crm">59         </property>60         <!-- 提供串連資料庫的使用者名稱和密碼 -->61         <property name="username" value="root"></property>62         <property name="password" value="123456"></property>63     </bean>64 65     <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">66         <property name="dataSource" ref="dataSource" />67         <property name="mapperLocations" value="classpath*:mapper/*Mapper.xml" />68     </bean>69     <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">70         <property name="basePackage" value="com" />71         <property name="annotationClass" value="org.springframework.stereotype.Repository"></property>72     </bean>73 74 </beans>

 

ssm applicationContent.xml

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.