<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
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-4.3.xsd">
<context:component-scan
base-package="要扫描的包名:例:com.test.dao">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Service" />
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Repository" />
</context:component-scan>
<bean id="dataSource"
class="com.alibaba.druid.pool.DruidDataSource"
p:driverClassName="com.mysql.cj.jdbc.Driver"
p:url="jdbc:mysql:///db_sell?serverTimezone=UTC" p:username="root"
p:password="root"></bean>
<bean id="jt" class="org.springframework.jdbc.core.JdbcTemplate"
p:dataSource-ref="dataSource"></bean>
</beans>
Spring 项目中applicationContext.xml模板
猜你喜欢
转载自blog.csdn.net/user_q/article/details/82951445
今日推荐
周排行