0
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)

这是我的控制器代码

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";
          }
      }

在我的 application-servlet 中,我也包含在内<mvc:annotation-driven/>

任何帮助表示赞赏。

<?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

>

4

0 回答 0