package org.tiscs.reststack.identity.datamappers;

import org.apache.commons.dbcp2.BasicDataSource;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.tiscs.reststack.core.contexts.AppContext;
import org.tiscs.reststack.core.contexts.DbContext;

import static org.junit.Assert.*;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppContext.class, DbContext.class}, loader = AnnotationConfigContextLoader.class)
public class UserMapperTest {
    @Autowired
    private BasicDataSource dataSource;

    @org.junit.Test
    public void findAll() throws Exception {
        assertNotNull(dataSource);
    }
}
@@ -59,43 +59,19 @@
 org.
-apache.commons.dbcp2.BasicDataSourc
+junit.Befor
 e;%0Ai
@@ -165,16 +165,71 @@
 owired;%0A
+import org.springframework.context.ApplicationContext;%0A
 import o
@@ -398,45 +398,31 @@
 ext.
-support.AnnotationConfigContextLoader
+web.WebAppConfiguration
 ;%0Aim
@@ -523,16 +523,69 @@
 Context;
+%0Aimport org.tiscs.reststack.core.contexts.WebContext;
 %0A%0Aimport
@@ -653,16 +653,37 @@
 .class)%0A
+@WebAppConfiguration%0A
 @Context
@@ -744,55 +744,27 @@
 lass
-%7D
 , 
-loader = AnnotationConfig
+Web
 Context
-Loader
 .class
+%7D
 )%0Apu
@@ -822,35 +822,215 @@
 ate 
-BasicDataSource dataSource;
+ApplicationContext applicationContext;%0A    private UserMapper userMapper;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        this.userMapper = applicationContext.getBean(UserMapper.class);%0A    %7D
 %0A%0A  
@@ -1118,18 +1118,18 @@
 ull(
-dataSource
+userMapper
 );%0A 

Add bean injection sample to "UserMapperTest.java";