Hello!
I am trying to reproduce your issue and in my example everything is ok. It
looks like you create your spring application without igniteSpringBean. Look
at my example, please.
/////////////////////////////////////////////////////////////////////
public class Main {
public static void main(String[] srgs) throws Exception {
BeanFactory appCtx = new
ClassPathXmlApplicationContext("/spring-bean.xml");
Ignite ignite = (Ignite) appCtx.getBean("igniteSpringBean");
ignite.compute().call(C.getList(10));
}
static public class C implements IgniteCallable<Integer> {
private static final long serialVersionUID = 4278959731940740185L;
@IgniteInstanceResource
private Ignite ignite;
@SpringApplicationContextResource
private ApplicationContext context;
@Override
public Integer call() throws Exception {
System.out.println("Ignite: " + ignite);
System.out.println("Context: " +
context.getBeanDefinitionNames());
System.out.println("---------------");
return 1;
}
public static List<C> getList(int size){
return IntStream.range(0, size - 1).mapToObj(i -> new
C()).collect(Collectors.toList());
}
}
}
///////////////////////////////////////////////////////
// spring-bean.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="beanToInject" class="java.lang.Integer">
<constructor-arg value="111" type="int"/>
</bean>
<bean id="igniteSpringBean" class="org.apache.ignite.IgniteSpringBean">
<property name="configuration">
<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="peerClassLoadingEnabled" value="true"/>
<property name="discoverySpi">
<bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>127.0.0.1:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/