Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SpringMVC重定向属性错误无法实例化bean类[org.springframework.web.servlet.MVC.support.RedirectAttributes]_Java_Spring_Servlets_Spring Mvc - Fatal编程技术网

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