[jboss-user] [JBoss Seam] - Re: When do I need a @Factory?

floba do-not-reply at jboss.com
Wed Aug 22 16:39:20 EDT 2007


yes I do.

here is what i have:

== Authenticator.java ===
@Stateful
@Scope(ScopeType.SESSION)
@Name("authenticator")
public class Authenticator
implements Authenticator_L

    @In( create = true )
    MySessionBean mySessionBean;

...

=== MySessionBean.java ===
@Stateful
@Scope( ScopeType.APPLICATION )
@Name( "mySessionBean" )
public class MySessionBean 
implements MySessionBean_L
{
	public String xyz(){ return "xyz"; }
	
	@Create
	public void create(){}
	
	@Destroy @Remove
	public void remove(){}
}

=== Factories.java ===
@Stateless
@Scope( ScopeType.EVENT )
@Name( "factories" )
public class Factories 
implements Factories_L
{
	
	@Logger Log log;

	@Factory( "mySessionBean" )
	public MySessionBean makeMySessionBean(){
		
		return new MySessionBean();
	}
}


With the Factories it works, without it dont.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077054#4077054

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077054



More information about the jboss-user mailing list