在EL中访问无状态会话bean的简单方法? [英] Easy way to access stateless session beans in EL?
本文介绍了在EL中访问无状态会话bean的简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
EL中是否有可能调用无状态会话bean的方法而不包含在备份bean中?在支持bean中包装方法调用会产生冗余代码,使得执行BU麻烦,因为必须包装每个方法。
Is there any possibility in EL to invoke a method of a stateless session bean without wrapping in a backing bean? Wrapping the method call in a backing bean produces redundant code and makes performing BU cumbersome as one has to wrap every single method.
推荐答案
您可以使用CDI的 @Named
进行注释。
You can just annotate it with CDI's @Named
.
例如
@Named
@Stateless
public class FooService {
// ...
}
设计的正确性是有问题的。它是IMHO紧耦合。我最多可以使用这种方法进行极小的webapps或快速原型设计。
The properness of the design is questionable. It's IMHO tight coupling. I'd use this approach at most for extremely small webapps or quick prototyping.
这篇关于在EL中访问无状态会话bean的简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文