Search code examples
javajbossjakarta-eeseam

Why may `@In(create = true)` not create the object in Seam?


I have a very simple piece of code that reads like:

@In(create = true) OutletHome outletHome;

It was working fine (using Seam 2.2.0.GA), and the object was being created and injected without any problems. But when I tried changing it to:

@In(create = true) OutletHome deactivationOutletHome;

It suddenly stopped working, causing the exception:

org.jboss.seam.RequiredException: @In attribute requires non-null value: customerHome.deactivationOutletHome

What could be the cause for such a problem? How is the variable name relevant? And how could I fix it?


Solution

  • Try,

    
    @In(create = true, value="outletHome")
    OutletHome deactivationOutletHome;
    

    Value you inject must be a seam component. When attribute "value" is missed is assumed that is equal to field name that into is injected.

    Others ways to access seam components are:

    
    @In(value="componentName", create = true)
    @In("#{componentName}")