API UIにSwagger 2を使用しています。だから、私のgradle.build
がありますSwagger2でSpring MVCエンドポイントを表示/非表示にする
compile "io.springfox:springfox-swagger2:${swaggerVersion}"
compile "io.springfox:springfox-swagger-ui:${swaggerVersion}"
私は以下のように闊歩を設定した:私は、私が定義されているAPIエンドポイントを取得するだけでなく、以下のようにSpring MVCのエンドポイントを取得しています
@Configuration
@Profile("!production")
@EnableSwagger2
@ComponentScan(basePackageClasses = com.company.controllers.ContentController.class)
public class SwaggerConfiguration {
@Autowired
private BuildInfo buildInfo;
@Bean
public Docket awesomeApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(this.awesomeApiInfo())
.select()
.apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
.build();
}
private ApiInfo awesomeApiInfo() {
return new ApiInfoBuilder()
.title("Awesome API - build #" + this.buildInfo.getVersion())
.description("Enter the IDs in order to look for the content")
.version("0.1")
.build();
}
}
:
は今、私はこれらのMVCのエンドポイントを取り除く必要があります。
ご協力いただきまして誠にありがとうございます。
spring mvcエンドポイントの表示を制限するにはどうすればよいですか?私は質問にスクリーンショットを添付しました。 –
あなたがプライベートに設定できるyamlファイルを持っているなら、制限するエンドポイントについては真です。 –