applicationContexts.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:tx="http://www.alibaba.com/schema/stat"
  6. xmlns:aop="http://www.springframework.org/schema/aop"
  7. xmlns:mvc="http://www.springframework.org/schema/mvc"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans.xsd
  10. http://www.springframework.org/schema/context
  11. http://www.springframework.org/schema/context/spring-context.xsd
  12. http://www.alibaba.com/schema/stat
  13. http://www.alibaba.com/schema/stat.xsd
  14. http://www.springframework.org/schema/aop
  15. http://www.springframework.org/schema/aop/spring-aop.xsd
  16. http://www.springframework.org/schema/mvc
  17. http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  18. <context:property-placeholder location="classpath:db.properties"/>
  19. <context:component-scan base-package="com"/>
  20. <!-- <tx:annotation-driven/>-->
  21. <aop:aspectj-autoproxy proxy-target-class="true"/>
  22. <mvc:annotation-driven/>
  23. <mvc:default-servlet-handler/>
  24. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
  25. <property name="driverClassName" value="${jdbc.driver}"/>
  26. <property name="url" value="${jdbc.url}"/>
  27. <property name="username" value="${jdbc.username}"/>
  28. <property name="password" value="${jdbc.password}"/>
  29. </bean>
  30. <!-- <mvc:interceptors>-->
  31. <!-- <mvc:interceptor>-->
  32. <!-- <mvc:mapping path="/**"/>-->
  33. <!-- <mvc:exclude-mapping path="/user/login"/>-->
  34. <!-- <mvc:exclude-mapping path="/user/login2"/>-->
  35. <!-- <mvc:exclude-mapping path="/user/register"/>-->
  36. <!-- <mvc:exclude-mapping path="/user/register2"/>-->
  37. <!-- <bean id="loginInterceptor" class="com.itstudy.Interceptor.MyInterceptor"/>-->
  38. <!-- </mvc:interceptor>-->
  39. <!-- </mvc:interceptors>-->
  40. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  41. <property name="dataSource" ref="dataSource"/>
  42. <property name="configLocation" value="classpath:mybatis-config2.xml"/>
  43. </bean>
  44. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  45. <property name="basePackage" value="com.group04"/>
  46. </bean>
  47. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  48. <property name="dataSource" ref="dataSource"/>
  49. </bean>
  50. <!--配置视图解析器-->
  51. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  52. <property name="prefix" value="/WEB-INF/pages/"/>
  53. <property name="suffix" value=".jsp"/>
  54. </bean>
  55. </beans>