spring3 mvc使用注解方式时,不能扫描jar包里面的类
是否有人遇到过这样的问题?
是否有人遇到过这样的问题?
解决方案 »
- jsp选择文件夹的路径 是文件夹 真的没有一个会的吗 老天呀
- 普通的java工程 ,不是web工程,连接mysql出错,高手请进
- JAVA中删除和查询能放到一条SQL语句吗?怎么写
- session 缓存问题
- 『Java』JNA访问本地库,Tomcat崩溃问题
- 关于jar包的问题
- 商务网站上的问题、、急!!!
- 使用log4j的问题
- 公司要做一个jsp的项目,要使用struts,请大家推荐好书!
- maven整合struts2,spring报错:No mapping found for dependency
- 有人知道restful么 应用广泛么 怎么问了好多人都说没听过阿
- spring-framework-3.0.6.RELEASE-dependencies.zip在哪下?
这一行:<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
注意那个version是不是大于2.0,而且schemaLocation指向web-app_3_0.xsd(或者2.5也行,至少要大于2.0)
web。xml
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">XX-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
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"><context:component-scan base-package="cn.cc.**.web" /><bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
</bean>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>xx</display-name> <context-param>
<param-name>webAppRootKey</param-name>
<param-value>xx.root</param-value>
</context-param> <context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param> <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext-*.xml
</param-value>
</context-param>
<servlet>
<servlet-name>xx</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>xx</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<session-config>
<session-timeout>120</session-timeout>
</session-config> <welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list> <error-page>
<exception-type>java.lang.Exception</exception-type>
<!-- Displays a stack trace -->
<location>/WEB-INF/jsp/uncaughtException.jsp</location>
</error-page></web-app>
不过这种方式太麻烦了