This is my project structure image
@Controller
public class LoginController{
@RequestMapping(value = "/registerUser.htm", method = RequestMethod.POST)
public String login(@RequestBody String userProfile){
String message = "Hi Im here";
try{
ApplicationContext context = new ClassPathXmlApplicationContext("/WEB-INF/ApplicationContext.xml");
UserProfile userProfile2= (UserProfile)context.getBean("userProfile") ;
System.out.println(message);
}catch(Exception e){
System.out.println(e.getMessage());
}
return message;
}
}
它抛出异常文件未找到。请帮帮我。
答案 0 :(得分:0)
尝试删除转发/
ApplicationContext context = new ClassPathXmlApplicationContext("WEB-INF/ApplicationContext.xml");
答案 1 :(得分:0)
您的文件实际上不包含在类路径中,例如尝试将其放在src / main / ressources下。所以你只能使用文件名