由jetty6升级为jetty9后,出现的问题

 

由jetty6升级为jetty9后,出现的问题:

1.升级jetty9 运行出现两个RequestMappingHandlerAdapter bean

org.springframework.beans.factory.UnsatisfiedDependencyException:

Error creating bean 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1'

原因:

之前的xml配置

<mvc:annotation-driven />
<bean 
		class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
		<property name="messageConverters">
			<list>
				<bean class="org.springframework.http.converter.FormHttpMessageConverter"></bean>
				<bean
					class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
				<bean
					class="org.springframework.http.converter.StringHttpMessageConverter">
					<property name="supportedMediaTypes">
						<list>
							<value>text/plain;charset=UTF-8</value>
						</list>
					</property>
				</bean>
			</list>
		</property>
	</bean> 

之后在网上看到了这篇文章:https://blog.csdn.net/xingbear/article/details/77838219

发现是mvn:annotation-driven的影响,<mvc:annotation-driven>会自动注册RequestMappingHandlerMapping与RequestMappingHandlerAdapter两个Bean,这是Spring MVC为@Controller分发请求所必需的,并且提供了数据绑定支持,@NumberFormatannotation支持,@DateTimeFormat支持,@Valid支持读写XML的支持(JAXB)和读写JSON的支持(默认Jackson)等功能。

修改后的springmvc-config.xml:

<mvc:annotation-driven >
	   <mvc:message-converters>
	        <bean class="org.springframework.http.converter.FormHttpMessageConverter"></bean>
			<bean
				class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
			<bean
				class="org.springframework.http.converter.StringHttpMessageConverter">
				<property name="supportedMediaTypes">
					<list>
						<value>text/plain;charset=UTF-8</value>
					</list>
				</property>
			</bean>
	   </mvc:message-converters>
</mvc:annotation-driven>

2.jetty6升级为jetty9之后,出现了maven jar包不兼容的情况,因为jetty版本与jdk版本和servlet-api版本都有紧密联系

参考文章:https://blog.csdn.net/jkdcoach/article/details/54311381

版本号发布及维护年份托管平台JVM版本支持的协议servlet版本JSP版本目前状态
9.32015Eclipse1.8HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI3.12.3Stable
9.22014Eclipse1.7HTTP/1.1 RFC2616,javax.websocket, SPDY v33.12.3Stable
82009-至今Eclipse/Codehaus1.6HTTP/1.1 RFC2616, WebSocket RFC 6455, SPDY v33.02.2Mature
72008-至今Eclipse/Codehaus1.5HTTP/1.1 RFC2616, WebSocket RFC 6455, SPDY v32.52.1Mature
62006-2010Codehaus1.4-1.5HTTP/1.1 RFC26162.52.0Venerable
52003-2009Sourceforge1.2-1.5HTTP/1.1 RFC26162.42.0Deprecated
42001-2006Sourceforge1.2,J2MEHTTP/1.1 RFC26162.31.2Ancient
31999-2002Sourceforge1.2HTTP/1.1 RFC20682.21.1Fossilized
21998-2000Mortbay1.1HTTP/1.0 RFC19452.11.0Legendary
11995-1998Mortbay1.0HTTP/1.0 RFC1945Mythical
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值