Quantcast
Channel: Spring beans redefinition in unit test environment - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by for Spring beans redefinition in unit test environment

$
0
0

I don't have the reputation points to pile on duffymo's answer, but I just wanted to chime in and say his was the "right" answer for me.

Instantiate a FileSystemXmlApplicationContext in your unit test's setup with a custom applicationContext.xml. In that custom xml, at the top, do an as duffymo indicates. Then declare your mock beans, non-JNDI data sources, etc, that will override the id's declared in the import.

Worked like a dream for me.


Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>