question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Spring] Generated controllers ignore basePath

See original GitHub issue

I have the following line in the openapi file:

basePath: "/v1"

I would expect generated controllers (interfaces) would use this basePath as prefix for all the paths, but they don’t contain this “v1” and just use resource path:

@RequestMapping(value = "/abc", method = RequestMethod.GET)

I’m using latest stable release 3.3.4.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
macjohnnycommented, Jan 18, 2019

you can manually add the base path to your application.yml:

server:
  servlet:
    context-path: /v1
2reactions
djeanprostcommented, Mar 30, 2020

Hello, This topic was fixed in swagger-codegen following this issue : 5244. If everybody agrees with the solution, could this be backported here too ? thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to ignore base path url in Spring MVC? - Stack Overflow
So, I don't want to duplicate this prefix for each controller not to change it everywhere iteratively whenever the prefix is changed.
Read more >
[Solved]-How to ignore base path url in Spring MVC?
If you don´t want to use the String in each Controller the only option that I can think of is the following. I...
Read more >
ignore server.servlet.context-path for webflux projects, support ...
context-path`` configuration property on displaying spring controller mappings and generating HTTP requests. This property is available, but is not applicable ...
Read more >
Documentation for the spring Generator
Property, Value, Notes. generator name, spring, pass this to the generate command after -g. generator stability, STABLE.
Read more >
Production-ready Features - Spring
The exclude property lists the IDs of the endpoints that should not be exposed. ... Spring Boot auto-configuration backs off and lets you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found