'Swagger is not enabled after putting @EnableConfigServer annotation in spring boot

I an try to enable Swagger 2.0 in the spring cloud config application (Spring boot - 2.5.0), I put @EnableConfigServer annotation in the main class.

But swagger is not working, when I am removing this annotation in this case swagger is working properly but the property file is not coming from GitHub repo in the microservice



Solution 1:[1]

Use

spring.cloud.config.server.prefix= /cloud

this line in your application properties for configure the cloud config server path. And give permission that address like that

    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring()
                .antMatchers("/cloud/**")
                .and()
                .httpFirewall(allowUrlEncodedSlashHttpFirewall());
    }

your cloud address will be like that

spring.config.import=optional:configserver:******/cloud

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1