Make it easier to use JSON libraries other than Jackson alongside REST Docs
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
Research direction
Reproduce the failure with the Gradle spring-restdocs-mockmvc:1.1.0.RELEASE dependency and the dispatcher-servlet.xml configuration shown in the issue. Start at the mvc:message-converters setup and inspect why GsonHttpMessageConverter is absent when REST Docs is added. Done means the existing custom converters remain available and the tests no longer crash.
Written by the indexing model from the issue text.
Description
My spring project works fine,
but tests crashes when I add spring-restdocs to gradle dependencies.
Just that (no configuration chages, no test code changes) brakes my project.
The problem is that spring-restdocs library make spring framework ignore mvc:message-converters configuration. (I'm not sure what is exactly happened)
I added gson over jackson for JSON as you can see below.
but with spring-restdocs, only I see is messageConverters without GsonHttpMessageConverter.
I have configuration like this: dispatcher-servlet.xml (there are applicationContext.xml and applicationContext-rest.xml as well)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
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-4.2.xsd">
<!-- message converter -->
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager">
<mvc:message-converters>
<ref bean="jaxbMessageConverter" />
<ref bean="gsonMessageConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
<bean id="gsonMessageConverter" class="org.springframework.http.converter.json.GsonHttpMessageConverter"/>
<bean id="jaxbMessageConverter" class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
<property name="marshaller" ref="jaxbMarshaller" />
<property name="unmarshaller" ref="jaxbUnmarshaller" />
<property name="supportedMediaTypes">
<list>
<value>application/xml</value>
<value>application/xml;charset=UTF-8</value>
</list>
</property>
</bean>
<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="packagesToScan">
<list>
<value>foo.boo.**.output</value>
</list>
</property>
</bean>
<bean id="jaxbUnmarshaller" name="unmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="packagesToScan">
<list>
<value>foo.boo.**.model</value>
</list>
</property>
</bean>
</beans>
gradle
dependencies {
testCompile 'org.springframework.restdocs:spring-restdocs-mockmvc:1.1.0.RELEASE'
}
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 731
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spring-projects/spring-restdocs
-
status: waiting-for-triage
Difficulty 5/5 Over a week Newbie friendliness 45/100
spring-projects/spring-restdocs#1026 · 2 comments ·
-
status: waiting-for-votes type: enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
spring-projects/spring-restdocs#1020 · 6 comments ·
-
type: enhancement
spring-projects/spring-restdocs#995 · 1 assignee ·
-
status: blocked status: waiting-for-triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
spring-projects/spring-restdocs#953 · 7 comments ·
-
type: enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in spring-projects/spring-restdocs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
checkstyle/test-configs#263 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·