[
http://www.stripesframework.org/jira/browse/STS-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11617#action_11617
]
Jarek Robakiewicz commented on STS-642:
---------------------------------------
We can close this bug if you explain me how can I use Spring and JPA annotation
together with SpringSupportIntereptor.
@PersistenceContext(unitName = "entityManagerFactory")
private EntityManager entityManager;
Base on Chris explanation I need wrap this code into the another class (DAO)
and this class can be injected.
My point is that SpringSupportIntereptor doesn't deliver what it promise:
integration with Spring. It gives me only support for Stripes annotation which
limit Spring functionality. This 2 line of codes give me what I need
AutowireCapableBeanFactory beanFactory =
springContext.getAutowireCapableBeanFactory();
beanFactory.autowireBeanProperties(bean,
AutowireCapableBeanFactory.AUTOWIRE_NO, false);
but to figure out this I spent 2 hours so I wrote this report to share this
problem with other developers.
Your explenation that SpringSupportIntereptor will be deprecated and you
introduce new factory based on the @SpringBean doesn't sound like a good idea.
It means that I cannot used latest features of Spring because of your custom
implementation of StripesUtils.injectBeans method. This solution will be always
out of date and for sure it is not what I understand as a integration with
Spring
> 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