【发布时间】:2016-12-19 07:14:24
【问题描述】:
我正在为特定技术编写自定义组件,但带有 @UriPath 注释的变量未初始化。 @UriParam 不过还可以。
我检查了 Kafka 和 Servlet 组件的端点源代码,但无法弄清楚它们与我的真正区别。
骆驼版本是:2.18.1
Endpont 是这样的:
@UriEndpoint(scheme = "elastic", title = "ElasticSearch", syntax = "elastic:url", label = "elastic")
public class ElasticSearchEndpoint extends DefaultEndpoint {
@UriPath
private String url;
@UriParam
private String searchType;
public ElasticSearchEndpoint(String endpointUri, ElasticSearchComponent component) {
super(endpointUri, component);
}
public Producer createProducer() throws Exception {
return new ElasticSearchProducer(this);
}
public Consumer createConsumer(Processor processor) throws Exception {
return null;
}
public boolean isSingleton() {
return false;
}
public String getUrl() {
return url;
}
public String getSearchType() {
return searchType;
}
public void setUrl(String url) {
this.url = url;
}
public void setSearchType(String searchType) {
this.searchType = searchType;
}
}
组件是由spring创建的:
<bean id="elastic" class="elasticsearch.ElasticSearchComponent" />
有什么想法吗?
【问题讨论】:
标签: apache-camel endpoint