使用@Remote(interface.class)

Ser*_*ari 5 annotations ejb

在ejb中使用@Remote(interface.class)有什么影响吗?

换句话说。这之间有什么区别:

@Remote(MyRemoteInterface.class)
@Stateless
public class MyBean implements MyRemoteInterface {
Run Code Online (Sandbox Code Playgroud)

和这个:

@Stateless
public class MyBean implements MyRemoteInterface {
Run Code Online (Sandbox Code Playgroud)

当界面是这样的时候:

@Remote
public interface MyRemoteInterface {
Run Code Online (Sandbox Code Playgroud)

当通过远程接口使用 bean 时,这两种解决方案都可以在 JBoss 6.4 上正常工作。

Gas*_*Gas 3

没有区别,只是编写方式不同,请参见 EJB 3.1 规范的 2.1.2:

接口可以在接口类上注解@Local或@Remote,也可以在bean类上注解@Local(.class)或@Remote(.class)