ScopeType.METHOD says
Each call to a bean session or JavaBean component places a new method context on the stack of method contexts associated with the current thread . The context is destroyed when the method returns.
Seam Seam. MethodContextInterceptor ( Seam), API
METHOD SFSB
MethodContextInterceptor.java .
@AroundInvoke
public Object aroundInvoke(InvocationContext ctx) throws Exception {
Component comp = getComponent();
String name = comp.getName();
Object target = ctx.getTarget();
Method method = ctx.getMethod();
Object[] parameters = ctx.getParameters();
Context outerMethodContext = Lifecycle.beginMethod();
try {
Contexts.getMethodContext().set(name, target);
Contexts.getMethodContext().set("org.jboss.seam.this", target);
Contexts.getMethodContext().set("org.jboss.seam.method", method);
Contexts.getMethodContext().set("org.jboss.seam.parameters", parameters);
Contexts.getMethodContext().set("org.jboss.seam.component", comp);
return ctx.proceed();
} finally {
Lifecycle.endMethod(outerMethodContext);
}
}
, , ScopeType.METHOD. , , Seam, The ScopeType.METHOD , . Seam in Action ScopeType.METHOD.
, , getUserByEmailAddress, . , " " .
,
, .
EntityQuery??? , Seam in Action
, , . , , , , , .
, . ,
@Entity, . , Seam. , EntityQuery ScopeType.EVENT
UserList userList = (UserList) Component.getInstance(UserList.class, ScopeType.EVENT);
for (...) {
userList.getUserByEmailAddress(emailId);
}
Seam Spring scope
Seam Spring Suited for
ScopeType.STATELESS singleton Service, repositories, Thread-safe components
ScopeType.APPLICATION singleton Service, repositories, Thread-safe components
ScopeType.SESSION session User login
ScopeType.CONVERSATION - Page flow
ScopeType.PAGE - Server-side based component model
ScopeType.EVENT request Non Thread-safe components
ScopeType.CONVERSATION Spring -. Seam ScopeType.CONVERSATION -. . , ScopeType.PAGE , , JSF, Wicket ..... ScopeType.STATELESS , Java EE ScopeType.APPLICATION, POJO EJB.