Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HandlerTypePredicate in spring-web #1258

Closed
amiraziz opened this issue Sep 4, 2021 · 1 comment
Closed

Add support for HandlerTypePredicate in spring-web #1258

amiraziz opened this issue Sep 4, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@amiraziz
Copy link

amiraziz commented Sep 4, 2021

Describe the feature

in my project, i need to add prefix for all @RestController beans mapping. so i add this config class:

@Configuration
public class AppConfiguration implements WebMvcConfigurer {

    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.addPathPrefix("/rest",
                HandlerTypePredicate.forAnnotation(RestController.class));
    }
}

after that i see swagger not preview correctly with default address, so I add this config keys:

springdoc.swagger-ui.path= swagger
springdoc.swagger-ui.url= /rest/api-docs

now i see this page with correct controller mapping but when i try it, url add prefix again and address change to /rest/rest/...

image

@RestController
public class WorkflowController {

    private final WorkflowService workflowService;
    private final Environment environment;


    public WorkflowController(WorkflowService workflowService, Environment environment) {
        this.workflowService = workflowService;
        this.environment = environment;
    }

    @PostMapping(value = "/phoneCharge")
    public GeneralResponse startChargeProcess(@Valid @RequestBody MerchantChargeRequestDto dto, HttpServletRequest request) {
        return workflowService.startChargeProcess(dto, request.getRemoteAddr(), "ChargeProcess");
    }
}

I use this versions:

spring-boot-starter-parent => 2.3.12.RELEASE
springdoc-openapi-data-rest & springdoc-openapi-ui => 1.5.9
@bnasslahsen bnasslahsen changed the title not detect correct url for call but preview correct that in ui Add support for HandlerTypePredicate in spring-web Sep 18, 2021
@bnasslahsen
Copy link
Contributor

The support has been added.
I have added a fix that you can test using the latest available snapshot v1.5.11-SNAPHOT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants