My bean is :
@Component public class KidsServerStartUp implements ServletContextListener { UploadService uplService; @Autowired public void setUplService( UploadService uplService ) { this.uplService = uplService; } public void contextInitialized(ServletContextEvent event) { System.out.println ( uplService ); } } In web.xml; I am firstly calling spring framework to set all beans ; then setting the startup listener :
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>com.kids.util.KidsServerStartUp</listener-class> </listener> uplService is getting printed as null !
OptimizeImagesis injected toUploadServicebut your code suggestesUploadServiceis injected toOptimizeImages, which one is correct? Where is the task scheduling code written?