1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <beans xmlns="http://www.springframework.org/schema/beans"
\r
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
\r
4 xmlns:util="http://www.springframework.org/schema/util"
\r
5 xmlns:tx="http://www.springframework.org/schema/tx"
\r
6 xmlns:jee="http://www.springframework.org/schema/jee"
\r
7 xsi:schemaLocation="http://www.springframework.org/schema/beans
\r
8 http://www.springframework.org/schema/beans/spring-beans.xsd
\r
9 http://www.springframework.org/schema/util
\r
10 http://www.springframework.org/schema/util/spring-util.xsd
\r
11 http://www.springframework.org/schema/tx
\r
12 http://www.springframework.org/schema/tx/spring-tx.xsd
\r
13 http://www.springframework.org/schema/jee
\r
14 http://www.springframework.org/schema/jee/spring-jee.xsd">
\r
17 1. There are two beans with the same id "dataSource"
\r
18 One declared in datasource-configuration.xml
\r
19 Another one declared in datasource-test-configuration.xml
\r
20 2. Both beans are declared in different XML files.
\r
21 3. Because there are in different XML files Spring does not complain about having duplicate beans.
\r
22 4. Because files in src/test will be loaded in class path after files in src/main this bean will
\r
23 override the one declared in datasource-configuration.xml when running JUnit Tests :)
\r
25 <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
\r
26 <property name="driverClassName" value="com.mysql.cj.jdbc.Driver" />
\r
27 <property name="url" value="jdbc:mysql://127.0.0.1:3737/mybatis_example?createDatabaseIfNotExist=true&allowMultiQueries=true&autoReconnect=true&characterEncoding=UTF-8" />
\r
28 <property name="username" value="root" />
\r
29 <property name="password" value="root" />
\r