小编use*_*720的帖子

记录通过 ElasticSearch 高级 Java 客户端构建的用于调试的 JSON 查询?

我在 Spring Boot 应用程序中使用 ElasticSearch 高级客户端 Java API。我想记录使用高级客户端 API 构建的查询以进行调试。

我的问题是我的 application.properties 文件中需要什么样的设置才能打开从我的应用程序构建的 JSON 查询?

我在 application.properties 文件中尝试了以下属性。但是,它不会打印使用各种查询构建器构建的 JSON 查询。

logging.level.org.elasticsearch.client=TRACE
logging.level.org.elasticsearch.client.sniffer=TRACE
logging.level.org.elasticsearch=TRACE
Run Code Online (Sandbox Code Playgroud)

logging elasticsearch resthighlevelclient

9
推荐指数
2
解决办法
2484
查看次数

如何在 Spring Boot 应用程序上的 Swagger API 中提供身份验证

我已经集成了 Swagger,以使用 Spring Boot 为 Spring REST 应用程序生成 API 文档。它运行良好,当我点击 URL 时,我可以看到生成的 API 文档:http://localhost:8080/test/swagger-ui.html 我的问题是如何限制对 API 的访问?基于硬编码用户名和密码的基本身份验证至少在开始时应该足够好。我使用 Maven 添加“swagger2”依赖项。

这是 pom.xml:

<dependency>                                                                           
    <groupId>io.springfox</groupId>                                                      
    <artifactId>springfox-swagger2</artifactId>                                          
    <version>2.7.0</version>                                                             
</dependency>                                                                          
<dependency>                                                                           
    <groupId>io.springfox</groupId>                                                      
    <artifactId>springfox-swagger-ui</artifactId>                                        
    <version>2.7.0</version>                                                             
</dependency>  
Run Code Online (Sandbox Code Playgroud)

这是招摇的配置:

@Configuration                                                                         
@EnableSwagger2                                                                        
public class SwaggerConfig {                                                           
    @Bean                                                                              
    public Docket api() {                                                              
        return new Docket(DocumentationType.SWAGGER_2)                                 
          .select()                                                                    
          .apis(RequestHandlerSelectors.basePackage("com.eeocd.test.ws.resource"))     
          .build();                                                                    
    }                                                                                  
}                                                                                      
Run Code Online (Sandbox Code Playgroud)

swagger swagger-2.0

5
推荐指数
1
解决办法
6892
查看次数