当前位置: 代码迷 >> J2EE >> 为什么小弟我的项目中使用不了Spring的注解,在其他的项目里面就可以呢?是什么阻碍了小弟我的注解
  详细解决方案

为什么小弟我的项目中使用不了Spring的注解,在其他的项目里面就可以呢?是什么阻碍了小弟我的注解

热度:79   发布时间:2016-04-17 23:42:23.0
为什么我的项目中使用不了Spring的注解,在其他的项目里面就可以呢?是什么阻碍了我的注解
这个是我Spring的配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd 
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
    <context:component-scan base-package="com.udc.control"></context:component-scan>
<!-- 数据源配置 -->
<bean id="propertyconfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:data.properties</value>
</property>
</bean>
<bean id="sysDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="jdbcUrl">
<value>${jdbc.url}</value>
</property>
<property name="user">
<value>${jdbc.username}</value>
</property>
<property name="password">
<value>${jdbc.password}</value>
</property>
<property name="checkoutTimeout">
<value>6000</value>
</property>
<property name="maxPoolSize">
<value>50</value>
</property>
<property name="minPoolSize">
<value>20</value>
</property>
<property name="initialPoolSize">
<value>20</value>
</property>
</bean>
<!-- 数据源配结束-->


<!-- 国际化配置  动态加载属性文件-->
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>WEB-INF/languageSource/messages</value>
</list>
</property>
<property name="useCodeAsDefaultMessage" value="true" />
</bean>
<!-- 配置I18N拦截器 -->
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"></bean>
<!-- 定义本地化处理器 -->
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver"></bean>

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors" ref="localeChangeInterceptor" />
<property name="mappings">
<props>
<prop key="/language.do">languageController</prop>
</props>
</property>
</bean>
<bean id="languageController" class="com.udc.sys.LanguageController"></bean>

<!-- 国际化配置结束-->

<bean id="resourceDao" class="com.udc.daoimpl.ResourceDaoImpl">
<property name="dataSource" ref="sysDataSource" />
</bean>



<bean id="UserDao" class="com.udc.daoimpl.UserDaoImpl">
<property name="dataSource" ref="sysDataSource" />
</bean>

<bean id="UserServer" class="com.udc.serverimpl.UserServerImpl">
<property name="userDao" ref="UserDao" />
</bean>

web.xml的配置

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


<servlet>
<servlet-name>dispatcherServlet</servlet-name>         
<servlet-class>             
org.springframework.web.servlet.DispatcherServlet 
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/spring_mvc.xml</param-value>
</init-param>
</servlet>      
<servlet-mapping>         
<servlet-name>dispatcherServlet</servlet-name>         
<url-pattern>*.do</url-pattern> 
</servlet-mapping>

这个是我的control层

这是页面提交

在我提交的时候总是报
 No mapping found for HTTP request with URI [/bds-2.1/movie/test.do] in DispatcherServlet with name 'dispatcherServlet'
这个错误,可恶的No mapping found for HTTP request with URI 
  相关解决方案