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

Unable to infer base url. #4064

Open
canfuu opened this issue May 19, 2023 · 1 comment
Open

Unable to infer base url. #4064

canfuu opened this issue May 19, 2023 · 1 comment
Labels

Comments

@canfuu
Copy link

canfuu commented May 19, 2023

My project is a empty project.
I just dep with springfox and spring-boot-2.5.12.
The pom.xml has a info:

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

And I has a configuration about spring-boot-web

@Configuration
public class WebConfiguration implements WebMvcConfigurer {


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.
                addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
                .resourceChain(false);
    }
}

And the Application.java has code:

@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
@EnableWebMvc
@EnableCaching
@EnableOpenApi
public class AppCenterApplication {

    public static void main(String[] args) {
        SpringApplication.run(AppCenterApplication.class, args);
    }
}

And the application.yml has some properties:

server:
  servlet:
    context-path: /appinfo
    encoding:
      force: true
      charset: UTF-8

Then I access 'http://localhost:8080/appinfo/swagger-ui/index.html'

it response a alert :

Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually:

@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant