Google News
logo
Java Springs - Interview Questions
How to Get ServletContext and ServletConfig Objects in a Spring Bean?
We can do either by implementing Spring-aware interfaces. The complete list is available here.
 
We could also use @Autowired annotation on those beans :
@Autowired
ServletContext servletContext;

@Autowired
ServletConfig servletConfig;
Advertisement