Could not find acceptable representation

Posted 博观约取 厚积薄发

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Could not find acceptable representation相关的知识,希望对你有一定的参考价值。

报了一个这个异常:

org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation

通过这篇文章找到了“favorPathExtension”关键字,
Spring Boot完美解决(406)Could not find acceptable representation原因及解决方法
进而找到了这篇文章中的方法,解决了问题
SpringMVC restful风格

	<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />
	
	<bean id="contentNegotiationManager"
		  class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
		<property name="favorPathExtension" value="false" />
		<property name="favorParameter" value="true" />
		<property name="parameterName" value="mediaType" />
		<property name="ignoreAcceptHeader" value="true"/>
		<property name="useJaf" value="false"/>
		<property name="defaultContentType" value="application/json" />

		<!--<property name="mediaTypes">
			<map>
				<entry key="json" value="application/json" />
				<entry key="xml" value="application/xml" />
			</map>
		</property>-->
	</bean>

以上是关于Could not find acceptable representation的主要内容,如果未能解决你的问题,请参考以下文章

sts安装出现could not find jar:file解决办法,could not find jar:file,sts安装

CMake Error: Could not find CMAKE_ROOT !!!

Maven - Could not find artifact

Spark: Could not find CoarseGrainedScheduler

./gradlew build:Could not find tools.jar. 解决方法

Uncaught Could not find Flash element