You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by 姜 为 <yd...@gmail.com> on 2015/11/14 15:58:21 UTC

About Ignite-Spring with GridService issue.

Hello,

	I’m using Ignite-Spring testing GridService rpc.

	Like this example https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java <https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java>

	I made change for SimpleMapServiceImpl use @Autowired to other service.
	
	Ignite start using same SpringApplicationContext:
		IgniteSpring.start(config, context);
	
	and @Autowired is success .

	But when Ignite.compute call  IgniteCallable service.
	The @Autowired service will be null.

	Is this I configured problem or Ignite issue?


Re: About Ignite-Spring with GridService issue.

Posted by Denis Magda <dm...@gridgain.com>.
Hi,

You have to use @SprintResource annotation if you want to inject something from a spring application context into Ignite’s compute task.
@Autowire annotation is not supported.

Best regards,
Denis

> On 16 нояб. 2015 г., at 7:03, 姜 为 <yd...@gmail.com> wrote:
> 
> I found hot to fix this, add @SpringResource to the field will work fine.
> 
>> 在 2015年11月16日,上午9:40,姜 为 <yd...@gmail.com> 写道:
>> 
>> Hi:
>> 	Here is example: https://github.com/wmz7year/ignite-test <https://github.com/wmz7year/ignite-test>
>> 	
>> 	I think the IgniteUtils.wrapThreadLoader load the class is not the spring proxy class.
>> 
>>    Does I’m right?
>> 
>>> 在 2015年11月14日,下午10:58,姜 为 <ydswcy513@gmail.com <ma...@gmail.com>> 写道:
>>> 
>>> Hello,
>>> 
>>> 	I’m using Ignite-Spring testing GridService rpc.
>>> 
>>> 	Like this example https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java <https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java>
>>> 
>>> 	I made change for SimpleMapServiceImpl use @Autowired to other service.
>>> 	
>>> 	Ignite start using same SpringApplicationContext:
>>> 		IgniteSpring.start(config, context);
>>> 	
>>> 	and @Autowired is success .
>>> 
>>> 	But when Ignite.compute call  IgniteCallable service.
>>> 	The @Autowired service will be null.
>>> 
>>> 	Is this I configured problem or Ignite issue?
>>> 
>> 
> 


Re: About Ignite-Spring with GridService issue.

Posted by 姜 为 <yd...@gmail.com>.
I found hot to fix this, add @SpringResource to the field will work fine.

> 在 2015年11月16日,上午9:40,姜 为 <yd...@gmail.com> 写道:
> 
> Hi:
> 	Here is example: https://github.com/wmz7year/ignite-test <https://github.com/wmz7year/ignite-test>
> 	
> 	I think the IgniteUtils.wrapThreadLoader load the class is not the spring proxy class.
> 
>     Does I’m right?
> 
>> 在 2015年11月14日,下午10:58,姜 为 <ydswcy513@gmail.com <ma...@gmail.com>> 写道:
>> 
>> Hello,
>> 
>> 	I’m using Ignite-Spring testing GridService rpc.
>> 
>> 	Like this example https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java <https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java>
>> 
>> 	I made change for SimpleMapServiceImpl use @Autowired to other service.
>> 	
>> 	Ignite start using same SpringApplicationContext:
>> 		IgniteSpring.start(config, context);
>> 	
>> 	and @Autowired is success .
>> 
>> 	But when Ignite.compute call  IgniteCallable service.
>> 	The @Autowired service will be null.
>> 
>> 	Is this I configured problem or Ignite issue?
>> 
> 


Re: About Ignite-Spring with GridService issue.

Posted by 姜 为 <yd...@gmail.com>.
Hi:
	Here is example: https://github.com/wmz7year/ignite-test
	
	I think the IgniteUtils.wrapThreadLoader load the class is not the spring proxy class.

    Does I’m right?

> 在 2015年11月14日,下午10:58,姜 为 <yd...@gmail.com> 写道:
> 
> Hello,
> 
> 	I’m using Ignite-Spring testing GridService rpc.
> 
> 	Like this example https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java <https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/servicegrid/ServicesExample.java>
> 
> 	I made change for SimpleMapServiceImpl use @Autowired to other service.
> 	
> 	Ignite start using same SpringApplicationContext:
> 		IgniteSpring.start(config, context);
> 	
> 	and @Autowired is success .
> 
> 	But when Ignite.compute call  IgniteCallable service.
> 	The @Autowired service will be null.
> 
> 	Is this I configured problem or Ignite issue?
>