[
https://issues.apache.org/jira/browse/IGNITE-884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14536897#comment-14536897
]
Valentin Kulichenko commented on IGNITE-884:
--------------------------------------------
For example, you want to inject Spring's {{JdbcTemplate}} into the store and
use {{@Autowired}} for that:
{code}
@Autowired
private JdbcTemplate jdbcTemplate;
{code}
This doesn't work in current implementation, because Spring is not aware about
the store instance, only about the factory.
Of course, there are workarounds (you can inject manually or do this
initialization in {{LifecycleAware.start()}}), but I suggest to do this
automatically to improve usability.
> Cache store usability issues
> ----------------------------
>
> Key: IGNITE-884
> URL: https://issues.apache.org/jira/browse/IGNITE-884
> Project: Ignite
> Issue Type: Bug
> Components: cache, newbie
> Affects Versions: sprint-4
> Reporter: Valentin Kulichenko
> Fix For: sprint-4
>
>
> * Need to validate read/write-through configuration. Currently, when cache
> store is configured, but {{readThrough}} and {{writeThrough}} flags on
> {{CacheConfiguration}} are switched off, the store will never be called,
> which is confusing. This case should be validated and proper warning should
> be printed out on startup (we can't throw an exception here because in some
> cases store implements only {{loadCache}} method and is not used for
> read/write-through).
> * Since cache store is instantiated by Ignite via factory, but not by Spring,
> user can't use Spring auto-wiring which is very common in Spring apps. Need
> to create utility method which will instantiate an instance with a factory
> and properly initialize it. All factory calls (store, expiry policy, ...)
> should be replaced with this utility method.
> To manually enable autowiring this code can be used:
> {code}
> appCtx.getAutowireCapableBeanFactory().autowireBean(obj);
> {code}
> ({{appCtx}} is Spring's {{ApplicationContext}})
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)