You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 23 Members of 4546 |
| Forum: Seam Users |
28. Aug 2008, 10:48 CET | Link |
hello
we are running a nice application with seam :-)
no we like to inject a pojo. this class is in a jar that is in the classpath. we do not want this to be annotated as ejb or a seam component.
i try use @In but it was always null.
i guess i have to declare it in a config file. but i do not know where.
thx :-)
Hi
Is the pojo annotated with Seam annotations? If it is there a seam.properties file in there so that it is scanned by Seam at startup?
If the pojo is discovered as a Seam component you should be able to see this in the log when the server starts up.
If not you could define the pojo as a bean in components.xml or in Spring or perhaps via faces-config.xml.
- micke
Seam can only inject/outject ejbs and pojos which are manageable and regocnized at startup of the web app. There are two (or even more ways) to inform seam about these manageable objects:
u have to use components.xml, if u cannot or do not want to recompile (using name-annotations) the target-class itself
example
thanks a lot that was what i looking for. i will test it and give you feedback. :-)
hello
thanks this works well in a normal bean. thanks a lot for you help.
now i like to use this bean the authenticator
every thing work well except of the injection of the
i did the following entry's in the components.xml:
<security:identity authenticate-method="#{authenticator.authenticate}"/> <component name="ldapServiceAuthenticate" class="com.xxx.ldap.LdapServiceAuthenticate" auto-create="true" scope="application">in my beans i use the following:
- in a normal bean i get the injected :-)
- in my i let inject the (work well), that get the injectet that is always null.
other things work well when we like that to be injected:
@Stateless @Name("authenticator") public class Authenticator implements IAuthenticator { @In Identity identity; @Out(required = false, scope = SESSION) private User user; @EJB private IConfigurationDAO configDAO; @EJB private IUserDAO userDAO; @EJB private ILDAPService ldapService; @In private FacesMessages facesMessages;@Stateless public class LDAPService implements ILDAPService { @In(create=true) private LdapServiceAuthenticate ldapServiceAuthenticate;that works well:
@Stateful @Scope(ScopeType.CONVERSATION) @Name("productCreationCtrl") public class ProductCreationController implements IProductCreationController { @In private FacesMessages facesMessages; @In(create=true) private LdapServiceAuthenticate ldapServiceAuthenticate;may someone has a clue why i can't inject something in the Authenticator or better in the LDAPService
best regards