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        xmlns:aop="http://www.springframework.org/schema/aop"
 6        xmlns:tx="http://www.springframework.org/schema/tx"
 7        xmlns:mvc="http://www.springframework.org/schema/mvc"
 8        xsi:schemaLocation="http://www.springframework.org/schema/beans
 9                 http://www.springframework.org/schema/beans/spring-beans.xsd
10                 http://www.springframework.org/schema/context
11                 http://www.springframework.org/schema/context/spring-context.xsd
12                 http://www.springframework.org/schema/aop
13                 http://www.springframework.org/schema/aop/spring-aop.xsd
14                 http://www.springframework.org/schema/tx
15                 http://www.springframework.org/schema/tx/spring-tx.xsd
16                 http://www.springframework.org/schema/mvc
17                 http://www.springframework.org/schema/mvc/spring-mvc.xsd">
18 
19     <!--数据库连接参数-->
20     <context:property-placeholder location="classpath:druid.properties"></context:property-placeholder>
21 
22     <!--数据源-->
23     <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
24         <property name="driverClassName" value="${jdbc.driver}"></property>
25         <property name="url" value="${jdbc.url}"></property>
26         <property name="username" value="${jdbc.username}"></property>
27         <property name="password" value="${jdbc.password}"></property>
28     </bean>
29 
30     <!--SqlSessionFactoryBean-->
31     <bean class="org.mybatis.spring.SqlSessionFactoryBean">
32         <property name="dataSource" ref="dataSource"></property>
33         <property name="typeAliases">
34             <array>
35                 <value>cn.itcast.domain.Item</value>
36             </array>
37         </property>
38     </bean>
39 
40     <!--mapper接口扫描-->
41     <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
42         <property name="basePackage" value="cn.itcast.dao"></property>
43     </bean>
44 
45 </beans>
applicationContext-dao.xml

相关文章:

  • 2021-05-20
  • 2022-02-07
  • 2021-11-13
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2021-07-02
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-06-02
相关资源
相似解决方案