-
1. Re: Problem with injection
wise_guybg Jul 26, 2007 12:01 PM (in response to chawax)Hi chawax,
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)) -
2. Re: Problem with injection
stephen.friedrich Jul 26, 2007 12:11 PM (in response to chawax)- 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"/>
-
3. Re: Problem with injection
chawax Jul 26, 2007 12:16 PM (in response to chawax)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 ? -
4. Re: Problem with injection
wise_guybg Jul 26, 2007 12:22 PM (in response to chawax)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. -
5. Re: Problem with injection
chawax Jul 26, 2007 12:25 PM (in response to chawax)OK, I'm going to try @In(create=true)
-
6. Re: Problem with injection
chawax Jul 26, 2007 12:37 PM (in response to chawax)It works. Thanks a lot ;)