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# - SharpSVN - How to get the previous revision? -

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

url - Querystring manipulation of email Address in PHP -