applicationContext.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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:c="http://www.springframework.org/schema/context"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xmlns:task="http://www.springframework.org/schema/task"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">
  8. <!--扫描组件-->
  9. <c:component-scan base-package="com.demo.wjj.service"/>
  10. <!--配置文件-->
  11. <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  12. <property name="locations">
  13. <list>
  14. <value>classpath:application.properties</value>
  15. <value>classpath:jdbc.properties</value>
  16. </list>
  17. </property>
  18. </bean>
  19. <!--数据源-->
  20. <bean id="datasource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
  21. <property name="driverClassName" value="${jdbc.driverName}"/>
  22. <property name="url" value="${jdbc.url}"/>
  23. <property name="username" value="${jdbc.username}"/>
  24. <property name="password" value="${jdbc.password}"/>
  25. </bean>
  26. <!--事务管理-->
  27. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  28. <property name="dataSource" ref="datasource"/>
  29. </bean>
  30. <tx:annotation-driven/>
  31. <import resource="mybatis-beans.xml"/>
  32. <!--短信发送服务-->
  33. <bean id="smsSendService" class="com.demo.wjj.service.impl.SmsSendServiceImpl">
  34. <property name="url" value="${sms.url}"/>
  35. <property name="name" value="${sms.username}"/>
  36. <property name="pwd" value="${sms.password}"/>
  37. <property name="sign" value="${sms.code.sign}"/>
  38. </bean>
  39. <bean class="com.demo.wjj.service.impl.ValidateCodeServiceImpl">
  40. <property name="smsSendService" ref="smsSendService"/>
  41. <property name="template" value="${sms.code.template}"/>
  42. </bean>
  43. <!-- 定时任务 -->
  44. <task:annotation-driven scheduler="qbScheduler" mode="proxy"/>
  45. <task:scheduler id="qbScheduler" />
  46. </beans>