Spring boot Swagger的配置…登录时出现问题

Spring boot Swagger的配置…登录时出现问题,spring-boot,authentication,swagger-ui,Spring Boot,Authentication,Swagger Ui,在我的Spring Boot项目中,我创建了如下的SwaggerConfig类: @Configuration @EnableSwagger2 public class SwaggerConfig extends WebMvcConfigurationSupport { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select()

在我的Spring Boot项目中,我创建了如下的SwaggerConfig类:

 @Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2).select()
                .apis(RequestHandlerSelectors.basePackage("com.springbootinfluxdb.api.controller"))
                .paths(PathSelectors.any()).build();
    }

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");

        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }

}
而application.properties是:

### DATABASE ###
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:postgresql://localhost:5433/test
spring.datasource.username=postgres
spring.datasource.password=postgres

server.port: 8088
当我尝试访问Swagger时,通过地址“localhost:8088/Swagger-ui.html#/”会出现以下登录界面:

但我没有登录凭据。 也许,我可以使用每次运行项目时eclipse输出控制台日志中显示的密码

我怎样才能解决这个问题??
请帮助我将此代码添加到您的安全配置类中:

@Configuration
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Override
    public void configure(WebSecurity web) throws Exception {
        web.ignoring().antMatchers("/v2/api-docs", "/swagger-ui.html");
    }

}

它总是要求我提供登录凭据。我的类现在扩展了WebSecurityConfigureAdapter,并按照您的建议添加了configure方法。。。但它总是要求我提供您的pom.xml文件和类安全配置的凭证上载信息,以帮助我了解核心问题