[
https://issues.apache.org/jira/browse/IGNITE-8740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16520861#comment-16520861
]
Amir Akhmedov commented on IGNITE-8740:
---------------------------------------
[~vkulichenko],
In general, we can add {{setIgnite(Ignite ignite)}} to make dependency
injection explicit but today you can pass instance of {{IgniteConfiguration}}
or set a path to {{IgniteConfiguration}} in
{{SpringCacheManager/}}{{SpringTransactionManager}} (SCM/STM) and it brings up
an Ignite instance (it's done in {{afterPropertiesSet()}})
But the issue occurs only if you want to use {{IgniteSpringBean}}. What's
happening today, since {{IgniteSpringBean}} implements
{{SmartInitializingSingleton}} it will start it's initialization right after
all singleton scope beans are initialized (which SCM and STM are) and since in
SCM/STM referring to Ignite instance in afterPropertiesSet() it can't find and
failing (ignite will be instantiated later in {{IgniteSpringBean}}).
So, what ApplicationListener<ContextRefreshedEvent> does, it's listening to
{{ContextRefreshedEvent}} which is published when all Spring beans are
initialized (including {{IgniteSpringBean}}). And what I'm doing is waiting to
this event to happen and finalizing SCM/STM initialization in
onApplicationEvent(ContextRefreshedEvent event) method.
> Support reuse of already initialized Ignite in IgniteSpringBean
> ---------------------------------------------------------------
>
> Key: IGNITE-8740
> URL: https://issues.apache.org/jira/browse/IGNITE-8740
> Project: Ignite
> Issue Type: Improvement
> Components: spring
> Affects Versions: 2.4
> Reporter: Ilya Kasnacheev
> Assignee: Amir Akhmedov
> Priority: Blocker
> Fix For: 2.6
>
>
> See
> http://apache-ignite-users.70518.x6.nabble.com/IgniteSpringBean-amp-Ignite-SpringTransactionManager-broken-with-2-4-td21667.html#a21724
> (there's patch available)
> The idea is to introduce a workaround for users hit by IGNITE-6555, which
> unfortunately broke some scenarios.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)