@Documented @Retention(value=RUNTIME) @Target(value=TYPE) public @interface WebServiceRefs
WebServiceRefs
注释允许多个Web服务引用是在类级别声明。
它可以用来注入服务和代理实例。这些注入的引用不是线程安全的。如果引用是由多个线程访问的,通常的同步技术可以用来支持多个线程。
没有任何方法将Web服务功能与注入的实例关联。如果一个实例需要配置Web服务的特点,用“webserviceref注入资源及其特征。
例子:的StockQuoteProvider
代理实例,和StockQuoteService
服务实例是使用“webservicerefs注入。
@WebServiceRefs({@WebServiceRef(name="service/stockquoteservice", value=StockQuoteService.class),
@WebServiceRef(name="service/stockquoteprovider", type=StockQuoteProvider.class, value=StockQuoteService.class})
public class MyClient {
void init() {
Context ic = new InitialContext();
StockQuoteService service = (StockQuoteService) ic.lookup("java:comp/env/service/stockquoteservice");
StockQuoteProvider port = (StockQuoteProvider) ic.lookup("java:comp/env/service/stockquoteprovider");
...
}
...
}
WebServiceRef
Modifier and Type | Required Element and Description |
---|---|
WebServiceRef[] |
value
用于多个Web服务引用声明的数组。
|
public abstract WebServiceRef[] value
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.