I think that you don't have an instance of serviceEmploye created so it cannot be injected. RequiredException, this means that Seam is searching for that instance to inject it.
There are two possibilities:
- you create such an instance before you go to the class that needs it
- you can tell Seam that this injection is not always required (@In(required=false))
- or use @In(create=true) to let seam create the component if needed
- or set the auto-create flag in components.xml:
<component name="serviceEmploye" auto-create="true" class="fr.horoquartz.t4.core.employe.ServiceEmployeBean" scope="STATELESS" jndi-name="t4Seam-1.0-SNAPSHOT/ServiceEmployeBean/local"/>
That's what I thought ... I expected that Seam create instance when needed (such as a lightweight container like Spring). So it does not ?
I tried to add @Startup to ServiceEmploye bean, but I had errors because the component had to be APPLICATION or SESSION scoped.
About the @In(required=false), does it mean that Seam will instantiate the component if it doesn't exist ?
I think @Startup is used for other tasks
@In(required=false) will not instantiate... it will leave it to null
@In(create=true) will instantiate
In my opinion Seam provides you with all the options you need.
OK, I'm going to try @In(create=true)
It works. Thanks a lot ;)