Java DispatcherServlet未将我的请求转发给控制器

Java DispatcherServlet未将我的请求转发给控制器,java,spring,spring-mvc,jboss,Java,Spring,Spring Mvc,Jboss,我正在使用spring框架编写web服务应用程序。应用程序中没有html或jsp页面。它纯粹是web服务 这是我的控制器类 @RequestMapping("/*") public class Opinion { private FeedbackService fs; public Opinion(FeedbackService fs){ this.fs=fs; } @RequestMapping(value="/givefeedba

我正在使用spring框架编写web服务应用程序。应用程序中没有html或jsp页面。它纯粹是web服务
这是我的控制器类

@RequestMapping("/*")
public class Opinion {


    private FeedbackService fs;

    public Opinion(FeedbackService fs){


        this.fs=fs;
    }


    @RequestMapping(value="/givefeedback",method=RequestMethod.POST)
    public void Login(HttpServletRequest request,HttpServletResponse response) throws IOException, ClassNotFoundException
    {
        ObjectInputStream in=new ObjectInputStream(request.getInputStream());
        serialize.Feedback feedback=(serialize.Feedback)in.readObject();
        fs.writeFeedback(feedback);
        response.setStatus(200);


    }
My mvc config.xml

<?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:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                            http://www.springframework.org/schema/tx
                            http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

    <bean id="poll_Web" class="sef.controller.Opinion">
        <constructor-arg ref="feedbackService" />
        </bean>

    <context:component-scan base-package="sef.controller" />



</beans>
<servlet>
        <servlet-name>opinionDispacher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value> classpath:repository-config.xml /WEB-INF/mvc-config.xml 
            </param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>opinionDispacher</servlet-name>  
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value> classpath:repository-config.xml /WEB-INF/mvc-config.xml 
        </param-value>
    </context-param>

My web.xml

<?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:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                            http://www.springframework.org/schema/tx
                            http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

    <bean id="poll_Web" class="sef.controller.Opinion">
        <constructor-arg ref="feedbackService" />
        </bean>

    <context:component-scan base-package="sef.controller" />



</beans>
<servlet>
        <servlet-name>opinionDispacher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value> classpath:repository-config.xml /WEB-INF/mvc-config.xml 
            </param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>opinionDispacher</servlet-name>  
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value> classpath:repository-config.xml /WEB-INF/mvc-config.xml 
        </param-value>
    </context-param>

意见发表者
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
类路径:repository-config.xml/WEB-INF/mvc-config.xml
意见发表者
/
org.springframework.web.context.ContextLoaderListener
上下文配置位置
类路径:repository-config.xml/WEB-INF/mvc-config.xml
我正在使用URL
localhost:8080/feedback/givefeedback
。应用程序部署为feedback.war。但是请求根本没有转发到控制器。我不知道为什么会这样。我也不确定该请求在链中到达哪一点。

您丢失了

<mvc:annotation-driven/>

它实际上没有任何用途。

您还在
mvc config.xml
中定义了两次
观点
bean。删除bean id的bean定义
poll\u Web

如果我对控制器发表意见,我会在部署期间遇到异常,说“无法创建bean意见”@ashwin向构造函数添加
@Autowired
注释。bean意见在mvc-config.xml中只定义一次。第二个在哪里?
-这将扫描包并创建使用注释定义的bean。例如,
@Controller
您可以找到有关组件扫描的更多信息