Hi guys,

Is it possible to bind an object declared in Spring's Application Context/Guice's Module to a bean that Xwork can inject via @Inject?

ie. Is there an ObjectFactory-independent way to depend on autowiring to xwork's @Inject without having to declare a bean in struts-plugin.xml?

The situation is that I've created a general security plugin that allows JSR-250 annotations to be applied to actions and action methods (@RolesAllowed, @Deny, etc). It reads the Role off the request's Principal, but as it many S2 users don't use CMS I also allow the roles to be retrieved from an AuthorizationService interface. I want the impl to be injected into the interceptors via XWork and allow the user to substitute in an alternative implementations. As an AuthorizationService is likely to have external dependencies (like EntityManager) the user will need to declare their implementation in their ApplicationContext/Guice Module rather than as a simple <bean> in struts.xml.

Is there a way to do this in a way that is ObjectFactory independent? (ie. I can inject straight from Spring or Guice into the interceptors but want to avoid assuming one or the other).

I presume the spring plugin can automatically autowire by name for a bean that is injected by XWork but isn't delared for xwork. I haven't actually tried it. The guice plugin doesn't do this but could also be modified to use a @Key (or autowiring available in the next version).

Does a solution already exist?

Thanks,
Jeromy Evans


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to