answered
2013-01-26 19:32:59 +0800
gekkio 899 ● 1
http://gekkio.fi/blog
Your Spring ApplicationContext doesn't contain the bean "examplesListService", so the wiring will not work. One of the reasons why I dislike @WireVariable is that it doesn't throw an exception if the wiring fails, it will just leave the field as null. This makes it difficult to debug stuff like this.
You are using component-scan element in the XML configuration, but that only works for beans that are annotated with something that component-scan supports (e.g. @Component, @service, @Repository). For example, your DAO will be managed by Spring correctly, because it includes the @Repository annotation.
Just add @service to examplesListService, and the wiring should work fine. Please note that you must also add @Autowired to the
private examplesListDao examplesListDao;
field in the service class, because otherwise it will be null, and your code will throw a NullPointerException in the service class.
BTW, the Java convention is to always use CamelCase class names and lowercase package names, so it's a good idea to rename the classes to start with an uppercase letter, and convert the package names to lowercase. Also, usually @Transactional is added to the service class methods, not to DAOs.
Any help please ?
Senthilchettyin ( 2013-01-25 18:31:00 +0800 )edit