swagger-api / swagger-api/swagger-codegen

【java-springmvc】 : 404 can't invoke the method from rest service

Open
#6,341 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

there are something wrong
first : Error creating bean with name 'documentationPluginsBootstrapper'
second:Error creating bean with name 'webMvcRequestHandlerProvider'
last one: org.springframework.http.InvalidMediaTypeException: Invalid mime type "json": does not contain '/'

I google some solutions , and finally i remove the annotation :@EnableWebMvc and @EnableSwagger2
then i can deploy my project , but , i can't use it .

the used url is :localhost:8002/Basic/resources/api/tb-build

as my expected, now i should have got the json data , but the truth is HTTP ERROR 404

Swagger-codegen version

2.2.1

Command line used for generation

java -jar J:\swagger-codegen-cli-2.2.1.jar generate
-i "C:\Users\Angelina\Desktop\Basic.json"
-l spring --library spring-mvc
-o server/basic/spring-mvc

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the swagger-codegen 2.2.1 command and the generated server/basic/spring-mvc project. Inspect how @EnableWebMvc and @EnableSwagger2 relate to the reported InvalidMediaTypeException, then reproduce the request to localhost:8002/Basic/resources/api/tb-build. Done means the generated Spring MVC service deploys without the bean or media-type errors and the URL no longer returns 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.