Reputation: 426
I wanted to add some values to the servletcontext, but am not sure how to get the object in spring. Can anyone please help
Upvotes: 3
Views: 642
Reputation: 11675
See this answer.
Implementing the ServletContextAware interface will make Spring to inject the context.
@Controller
public class ServicesImpl implements Services, ServletContextAware{
private ServletContext context;
public void setServletContext(ServletContext servletContext) {
this.context = servletContext;
}
Upvotes: 1