问题
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.
回答1:
You can just annotate it with CDI's @Named
.
E.g.
@Named
@Stateless
public class FooService {
// ...
}
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.
来源:https://stackoverflow.com/questions/12988089/easy-way-to-access-stateless-session-beans-in-el