Generate dependencies for Spring TestContext Framework

IntelliJ IDEA 10 gives you an easy way of generating bean dependencies for Spring Test Contexts.
Simply hit Alt+Insert in your Spring Test to invoke the “Generate…” popup, select the “Bean dependency…” action to run and choose the beans you like.

IntelliJ IDEA actually runs a live template inside to complete the code generation. It creates @Autowired field and adds @Qualifier if more than one bean of the desired type is configured in test contexts.

In addition, you can try “Add @Qualifier” quick fix for an incorrect @Autowired class members

It runs a live template and generates the @Qualifier annotation.

Try it in IntelliJ IDEA X EAP and let us know what you think.

image description