我的下拉向导服务器需要调用外部REST资源,为此,我计划使用泽西客户端,为此,我在pom.xml中添加了以下依赖项:
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-client</artifactId>
<version>1.4.0-SNAPSHOT</version>
</dependency>然后,我按照以下方式添加了yml配置:
jerseyClient:
minThreads: 1
maxThreads: 128
workQueueSize: 8
gzipEnabled: true
gzipEnabledForRequests: true
chunkedEncodingEnabled: true在我的WebConfiguration类中,我添加了以下代码:
@Valid
@NotNull
private JerseyClientConfiguration jerseyClient = new JerseyClientConfiguration();
@JsonProperty("jerseyClient")
public JerseyClientConfiguration getJerseyClientConfiguration() {
return this.jerseyClient;
}当我尝试运行我的WebApplication时,我会得到以下错误:
api.yml has an error:
* Unrecognized field at: jerseyClient
Did you mean?:
- server
- assets
- logging
- metrics
- database
[1 more]
Process finished with exit code 1这里怎么了?是否不允许在下拉向导服务器上使用下拉向导客户端?还是简单的压痕问题?
更新:
在添加jerseyClient配置失败后,我尝试添加HttpClient,它为我工作。
发布于 2021-08-09 18:25:02
尝试在@JsonProperty扩展文件中添加setter with Configuration扩展文件。
这对我有用。
在Configration文件中
@Valid
@NotNull
private JerseyClientConfiguration jerseyClient = new JerseyClientConfiguration();
@JsonProperty("jerseyClient")
public JerseyClientConfiguration getJerseyClientConfiguration() {
return jerseyClient;
}
@JsonProperty("jerseyClient")
public void setJerseyClientConfiguration(JerseyClientConfiguration jerseyClient) {
this.jerseyClient = jerseyClient;
}在config.yml文件中。
jerseyClient:
minThreads: 2
maxThreads: 128
workQueueSize: 8
gzipEnabled: true
gzipEnabledForRequests: true
chunkedEncodingEnabled: true
server:
applicationConnectors:
- type: http
port: 8085https://stackoverflow.com/questions/54884455
复制相似问题