@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.