--- /dev/null
+package de.spring.example.persistence.repository;
+
+import javax.inject.Inject;
+
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.palantir.docker.compose.DockerComposeRule;
+import com.palantir.docker.compose.connection.waiting.HealthChecks;
+
+import de.spring.example.persistence.domain.AdDescription;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration( {"classpath*:spring-configuration/*.xml",
+ "classpath*:spring-configuration-docker-test/*.xml"} )
+@Transactional
+public class AdDescriptionRepositoryShould {
+
+ @Inject
+ AdDescriptionRepository adDescriptionRepository;
+
+ @ClassRule
+ public static final DockerComposeRule DOCKER = DockerComposeRule.builder()
+ .file("src/integTest/resources/docker/docker-compose.yml")
+ .waitingForService("mysql", HealthChecks.toHaveAllPortsOpen())
+ .saveLogsTo("build/dockerLogs")
+ .build();
+
+ @Test public void
+ find_ad_descriptions_by_ad() {
+ Iterable<AdDescription> adDescriptions = adDescriptionRepository.findAll();
+
+ Iterable<AdDescription> lol = adDescriptions;
+
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xmlns:util="http://www.springframework.org/schema/util"\r
+ xmlns:tx="http://www.springframework.org/schema/tx"\r
+ xmlns:jee="http://www.springframework.org/schema/jee"\r
+ xsi:schemaLocation="http://www.springframework.org/schema/beans\r
+ http://www.springframework.org/schema/beans/spring-beans.xsd\r
+ http://www.springframework.org/schema/util\r
+ http://www.springframework.org/schema/util/spring-util.xsd\r
+ http://www.springframework.org/schema/tx \r
+ http://www.springframework.org/schema/tx/spring-tx.xsd\r
+ http://www.springframework.org/schema/jee\r
+ http://www.springframework.org/schema/jee/spring-jee.xsd">\r
+ \r
+ <!-- \r
+ 1. There are two beans with the same id "dataSource"\r
+ One declared in datasource-configuration.xml\r
+ Another one declared in datasource-test-configuration.xml\r
+ 2. Both beans are declared in different XML files.\r
+ 3. Because there are in different XML files Spring does not complain about having duplicate beans.\r
+ 4. Because files in src/test will be loaded in class path after files in src/main this bean will\r
+ override the one declared in datasource-configuration.xml when running JUnit Tests :)\r
+ -->\r
+ <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">\r
+ <property name="driverClassName" value="com.mysql.cj.jdbc.Driver" />\r
+ <property name="url" value="jdbc:mysql://127.0.0.1:3737/mybatis_example?createDatabaseIfNotExist=true&allowMultiQueries=true&autoReconnect=true&characterEncoding=UTF-8" />\r
+ <property name="username" value="root" />\r
+ <property name="password" value="root" />\r
+ </bean>\r
+ \r
+</beans>\r