context.xml 1.3 KB

1234567891011121314151617181920212223
  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. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/context
  8. https://www.springframework.org/schema/context/spring-context.xsd">
  9. <!-- <bean id="userService1" class="com.service.impl.UserServiceImpl">-->
  10. <!--&lt;!&ndash; <constructor-arg name="userDao" ref="UserDao"></constructor-arg>&ndash;&gt;-->
  11. <!-- </bean>-->
  12. <!-- 加载外部 properties文件-->
  13. <context:property-placeholder location="jdbc.properties"></context:property-placeholder>
  14. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
  15. <property name="driverClassName" value="${jdbc.driver}"></property>
  16. <property name="url" value="${jdbc.url}"></property>
  17. <property name="username" value="${jdbc.username}"></property>
  18. <property name="password" value="${jdbc.password}"></property>
  19. </bean>
  20. <!-- 组件扫描-->
  21. <context:component-scan base-package="com"></context:component-scan>
  22. </beans>