在ejb中使用@Remote(interface.class)会有什么影响吗?
换一种说法。 这有什么区别:
@Remote(MyRemoteInterface.class) @Stateless public class MyBean implements MyRemoteInterface {和这个:
@Stateless public class MyBean implements MyRemoteInterface {当接口看起来像这样:
@Remote public interface MyRemoteInterface {当通过远程接口使用bean时,这两种解决方案在JBoss 6.4上运行良好。
Does the use of @Remote(interface.class) in the ejb have any impact?
In other words. What's the diference between this:
@Remote(MyRemoteInterface.class) @Stateless public class MyBean implements MyRemoteInterface {And this:
@Stateless public class MyBean implements MyRemoteInterface {When the inteface looks like this:
@Remote public interface MyRemoteInterface {Both solutions works fine on JBoss 6.4 when using the bean through the remote inteface.
最满意答案
没有区别,只是它的编写方式不同,请参阅EJB 3.1规范的2.1.2:
接口可以在接口类上使用@Local或@Remote进行注释,或者在bean类上使用@Local(.class)或@Remote(.class)进行注释
There is no difference, its just different way of writing it, see 2.1.2 of the EJB 3.1 spec:
使用@Remote(interface.class)(Use of @Remote(interface.class))The interface can be annotated on with @Local or @Remote on the interface class, or annotated with @Local (.class) or @Remote (.class) on the bean class
在ejb中使用@Remote(interface.class)会有什么影响吗?
换一种说法。 这有什么区别:
@Remote(MyRemoteInterface.class) @Stateless public class MyBean implements MyRemoteInterface {和这个:
@Stateless public class MyBean implements MyRemoteInterface {当接口看起来像这样:
@Remote public interface MyRemoteInterface {当通过远程接口使用bean时,这两种解决方案在JBoss 6.4上运行良好。
Does the use of @Remote(interface.class) in the ejb have any impact?
In other words. What's the diference between this:
@Remote(MyRemoteInterface.class) @Stateless public class MyBean implements MyRemoteInterface {And this:
@Stateless public class MyBean implements MyRemoteInterface {When the inteface looks like this:
@Remote public interface MyRemoteInterface {Both solutions works fine on JBoss 6.4 when using the bean through the remote inteface.
最满意答案
没有区别,只是它的编写方式不同,请参阅EJB 3.1规范的2.1.2:
接口可以在接口类上使用@Local或@Remote进行注释,或者在bean类上使用@Local(.class)或@Remote(.class)进行注释
There is no difference, its just different way of writing it, see 2.1.2 of the EJB 3.1 spec:
The interface can be annotated on with @Local or @Remote on the interface class, or annotated with @Local (.class) or @Remote (.class) on the bean class
发布评论