I am using the Spring MVC project from Netbeans and I moved the applicationContext.xml file to / src / conf because I read WEB-INF, this is not the right folder. I cannot access the application context from the controller in / src / java / web / controller. I tried several ways and it does not deploy the project.
I need a link to learn more about paths in a web project, please.
I think this may help us understand:
public class TasksController implements Controller { private TaskManager taskManager; protected final Log logger = LogFactory.getLog(getClass()); public TaskController() { ApplicationContext context = new FileSystemXmlApplicationContext("/WEB-INF/applicationContext.xml"); taskManager = (TaskManager)context.getBean("taskManager"); } @Override public ModelAndView handleRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { logger.info("Returning view from TaskController"); Map<String,Object> tasks = new HashMap<String,Object>();
Bye!
source share