applicationContext.xml 2.2 KB

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