Spring MVC: inject servletcontext in controller 

Joined:
08/13/2009
Posts:
172

December 30, 2013 14:20:28    Last update: December 30, 2013 14:20:28
Example code that injects servletContext in a controller:
import javax.servlet.ServletContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class MyController {
    @Autowired
    ServletContext servletContext;
    .
    .
    .
}
Share |
| Comment  | Tags