gpt4 book ai didi

annotations - JAX-WS 实现注释与接口(interface)注释

转载 作者:行者123 更新时间:2023-12-04 04:59:02 27 4
gpt4 key购买 nike

我使用注释配置我的 JAX-WS Web 服务。我使用了一个端点接口(interface),该接口(interface)带有一些值的注释,供服务器和客户端使用,因此它们共享接口(interface)。

我的界面如下所示:

@WebService(name = Constants.NAME, serviceName = Constants.SERVICE_NAME, targetNamespace = Constants.NAMESPACE)
@SOAPBinding
public interface IManagementBean {
@WebMethod(operationName = "getStatistics")
IGetStatsResponse getStatistics(IGetStatsRequest request,
@WebParam(name = "gridName", header = true, partName = "gridName") String gridName)
throws WebServiceException;
}

在相应的实现中,我使用相同的注释,这对我来说看起来很多余。

有没有办法告诉实现从接口(interface)“拉”注释而不是在两边都定义它们?

最佳答案

如果您不喜欢该界面,请避开该界面。

You can safely start without any interfaces and introduce them later as the need arises. This approach is fundamentally different from that in Java EE 5. Compared to Java 2 Platform, Enterprise Edition (J2EE) from 2003, Java EE 6 code is simpler, in terms of the elimination of several layers, indirections, and abstractions. Unlike J2EE, Java EE 6 consists of annotated classes without any dependencies on the platform. This approach eliminates the need to separate business logic from the infrastructure and makes the majority of J2EE patterns and best practices superfluous. In Java EE 6, simple cases can be solved with two layers: presentation and business logic.



Java EE 6: Simplicity by Design - Adam Bien

关于annotations - JAX-WS 实现注释与接口(interface)注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16373355/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com