I have a Spring Boot where I autoconfigure a Router bean. All this works fine, but it becomes a problem when I want to enter a bean in a user servlet:
public class MembraneServlet extends HttpServlet {
@Autowired
private Router router;
@Override
public void init() throws ServletException {
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
new HttpServletHandler(req, resp, router.getTransport()).run();
}
}
It should be the way, but
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
will not authorize the router since it is WebapplicationContextalways null. The application runs in an MVC environment.
source
share