[
http://www.stripesframework.org/jira/browse/STS-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11618#action_11618
]
Chris Herron commented on STS-642:
----------------------------------
The only promises made are documented on the Stripes website (Spring section
already linked above), and in the JavaDoc:
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/integration/spring/package-summary.html
Nowhere does Stripes promise to elevate ActionBeans to be full Spring-managed
beans, or to support Spring features such as autowiring. So, its unfair to call
this a bug when the code behaves as designed, and as documented.
By adding a call to AutowireCapableBeanFactory.autowireBeanProperties, Spring
@Autowired and @PersistenceContext annotations could be used within Stripes
ActionBeans. This would make Stripes ActionBeans seem more like actual Spring
beans, yet they would not be, because the ActionBean itself would not be
wrapped in a Spring proxy. This would mean that cross-cutting Spring services
such as annotation driven transactions would not work within Stripes
ActionBeans. In short, implementing this would lead to more confusion, and
further requests for increased Spring assimilation. I sympathize with heavy
Spring users who want to do this, but don't believe it should be up to Stripes
to go this far.
The new ObjectFactory interface in Stripes 1.5.1 will actually provide an easy
way for Jarek to implement his
AutowireCapableBeanFactory.autowireBeanProperties call without having to change
any Stripes classes. He would just implement his own ObjectFactory - which
could be similar to the SpringInjectionFactory on the trunk destined for
Stripes 1.6.
To wrap this all up:
* SpringSupportIntereptor works as designed and documented
* Three different workarounds have been suggested in this comments thread
(StripesStuff's SpringObjectFactory, delegation to a Spring Bean DAO,
user-provided ObjectFactory)
* The implicit feature request is debatably beyond the scope of Stripes'
manifesto
@Freddy, in my opinion this could be closed as "not a bug" or changed to be a
feature request.
> SpringInterceptorSupport doesn't wire JPA @ PersistenceContext annotation
> --------------------------------------------------------------------------
>
> Key: STS-642
> URL: http://www.stripesframework.org/jira/browse/STS-642
> Project: Stripes
> Issue Type: Bug
> Reporter: Jarek Robakiewicz
> Priority: Minor
>
> Spring interceptor uses SpringHelper#injectBeans method which has custom
> implementation of bean injection. This implementation ignores standard JPA
> annoation supported by Spring.
> Using only Spring, this annotation works fine:
> AutowireCapableBeanFactory beanFactory =
> springContext.getAutowireCapableBeanFactory();
> beanFactory.autowireBeanProperties(bean,
> AutowireCapableBeanFactory.AUTOWIRE_NO, false);
> and is implemented by Spring Post processor
> PersistenceAnnotationBeanPostProcessor#private InjectionMetadata
> findPersistenceMetadata(final Class clazz)
> @SpringBean seems to be duplicate responsibility of @java.annotation.Resource
> supported also by Spring. It provides capabiltiy of bean injection for
> private fields (BTW not very useful during unit tests)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development