springmvc-config.xml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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:mvc="http://www.springframework.org/schema/mvc"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xsi:schemaLocation="
  7. http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans.xsd
  9. http://www.springframework.org/schema/context
  10. http://www.springframework.org/schema/context/spring-context.xsd
  11. http://www.springframework.org/schema/mvc
  12. http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  13. <context:property-placeholder location="classpath:db.properties"/>
  14. <context:component-scan base-package="WebsiteES"/>
  15. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
  16. <property name="driverClassName" value="${jdbc.driver}"/>
  17. <property name="url" value="${jdbc.url}"/>
  18. <property name="username" value="${jdbc.username}"/>
  19. <property name="password" value="${jdbc.password}"/>
  20. </bean>
  21. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  22. <property name="dataSource" ref="dataSource" />
  23. <property name="configLocation" value="classpath:MyBatis-config.xml"/>
  24. </bean>
  25. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  26. <property name="basePackage" value="WebsiteES.myBatis"/>
  27. </bean>
  28. <!--Spring MVC.....(for primary web service)-->
  29. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  30. <property name="prefix" value = "/"/>
  31. <property name="suffix" value = ".jsp"/>
  32. </bean>
  33. <!-- should add multipartResolver to use -->
  34. <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  35. <property name="defaultEncoding" value="utf-8"/>
  36. <property name="maxUploadSize" value="2097152"/>
  37. </bean>
  38. <mvc:annotation-driven/>
  39. <mvc:default-servlet-handler/>
  40. <!-- <mvc:interceptors>
  41. <mvc:interceptor>
  42. <mvc:mapping path="/*"/>
  43. <mvc:exclude-mapping path="/login"/>
  44. <mvc:exclude-mapping path="/regist"/>
  45. <bean id="InterceptorLogin" class="WebsiteES.InterceptorLogin"/>
  46. </mvc:interceptor>
  47. </mvc:interceptors> -->
  48. </beans>