Update 5: I\'ve downloaded the latest Spring ToolsSuite IDE based on the latest Eclipse. When I import my project as a Maven project, Eclipse/STS appears to
making a field of a @configurable class Autowired throws NullPointerException if you do not configure your spring properly for this annotation.
follow these steps to make @configurable annotations work properly
This method is called AspectJ build time weaving to inject spring beans to your non-spring-made classes.
First step is to install these plugins in eclipse:
From these two update sites install whatever eclipse suggests:
Important: DO NOT use any tag under tag.
your pom.xml needs to be something like this:
....
....
....
....
....
finally add to your spring application context config file.
Now you can annotate a POJO class as @Configurable and inject spring beans in it using @Autowired annotation. this way whenever you make a new instance of that POJO it will be configured (e.g. injected with dependencies) automatically.