java - Access Spring beans from a servlet in JBoss got property null -
i had follow link: access spring beans servlet in jboss autowired bean properties in bean null ? problem ? please, me. new java !!!
public class myservlet extends httpservlet { @autowired private myservice myservice; public void init(servletconfig config) { super.init(config); springbeanautowiringsupport.processinjectionbasedonservletcontext(this, config.getservletcontext()); } }
spring needs way inject value servlet. try adding public getter , setter:
public void getmyservice() { return this.myservice; } public void setmyservice(myservice s) { this.myservice = s; }
or constructor takes myservice:
public myservlet(myservice s) { this.myservice = s; }
Comments
Post a Comment