java - spring junit testing -


i have maven spring project (latest version) , want write junit tests (latest version).

the issue have spring beans autowired, , when call them junit test, null pointer exceptions, spring doesn't autowire them.

how can load context things autowired?

have studied testing chapter in spring reference documentation? here example should start with:

@runwith(springjunit4classrunner.class) @contextconfiguration public class mytest {      @resource     private fooservice fooservice;      // class body... } 

if in com.example.mytest in /src/test/java, need /src/test/resources/com/example/mytest-context.xml - exceptions show way.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -