This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

@Autowired does not work with my SOAP handler class. Throws a nullPointerException?Page Title Module

@Autowired does not work with my SOAP handler class. Throws a nullPointerException?

Nov 21st, 2012, 04:01 AM

This is my SOAP Handler class to generate security service handlers for a CRM. Everything was working fine as I hard coded my credentials - Username & Password. Now I tried to remove the hard-coding by defining the credentials in a properties file and autowiring it in this class. This method is not working and Spring throws a NullPointerExc (autowiring not happening I guess!) everytime I try to access my CRM. Why does @Autowired not work here while it works perfectly well my @Service, @Controller classes? Here is my code:

The SoapHandler isn't managed by spring at least not the instance used that is constructed by Jax-WS and as such spring has no control. If you want spring to manage your handlers you also need spring to manage your jax-ws endpoint or make the SoapHandler @Configurable and use loadtime weaving to get the depenencies injected.