Search code examples
javatomcatswaggerswagger-maven-plugin

why swagger-maven-plugin changed my output to "application/xhtml+xml"?


I am new to swagger-maven-plugin and I added it to pom.xml, the swagger.json was generated but all my REST api is not working anymore

I found that in the response header "content type" was changed to application/xhtml+xml and all former returned json data now became xml like

<JSONObject xmlns=""><preferences><booking><qualityManual></qualityManual>

while before it was

{"preferences":{"booking":{"qualityManual":{},

can anyone help? Did I mis-configed something?

I am using version 3.1.4


Solution

  • The cause is I shouldn't add below to pom file:

    <dependency>
    <groupId>com.github.kongchen</groupId>
    <artifactId>swagger-maven-plugin</artifactId>
    <version>3.1.4</version>
    </dependency>
    

    while they shouldn't be there and actually I just need to config the plugin in the plugin section.