Java SpringMVC重定向属性错误无法实例化bean类[org.springframework.web.servlet.MVC.support.RedirectAttributes]
这是我的控制器代码Java SpringMVC重定向属性错误无法实例化bean类[org.springframework.web.servlet.MVC.support.RedirectAttributes],java,spring,servlets,spring-mvc,Java,Spring,Servlets,Spring Mvc,这是我的控制器代码 org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.servlet.mvc.support.RedirectAttributes]: Specified class is an interface at org.springframework.beans.BeanUtils.instantiateC
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.servlet.mvc.support.RedirectAttributes]: Specified class is an interface
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:102)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.newCommandObject(MultiActionController.java:521)
在我的应用程序servlet中,我还包括了
谢谢你的帮助
public String loginControl(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes) throws NoSuchAlgorithmException{
boolean status = false;
String redirect = "home";
String userName = request.getParameter("username");
String password = request.getParameter("password");
if(Utils.isNotNullNotEmptyNotWhiteSpaceOnly(userName) && Utils.isNotNullNotEmptyNotWhiteSpaceOnly(password)){
User user = homeService.checkLogin(userName, password);
if(user != null){
HttpSession session = request.getSession(true);
session.setAttribute("loggedUser", user);
redirectAttributes.addFlashAttribute("status", "success");
redirectAttributes.addFlashAttribute("messageHdr", "Password changed successfully");
return "redirect:/home.mth";
}
}
粘贴您的pom.xml/build path条目..似乎jar问题我也检查了构建路径,似乎一切正常。您可以发布应用程序配置文件您使用的是哪个版本的spring吗?spring版本是4.0
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<bean id="urlHandler" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
</bean>
<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/web/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans