Hi Wei Jiang,

You can inject @SpringResource and @SpringApplicationContextResource into Ignite Service or Ignite Compute. This feature is not supported for individual cache entries, at least because of performance reasons.
@Autowired is unsupported for both Ignite services and computes.

So if you need to process the entries inside of Ignite Compute or Ignite Service then just inject a resource there using one of the annotations above.

The main point here is that all the nodes have to be started as a part of spring app context or have to have a reference to it.
Please refer to org.apache.ignite.IgniteSpring for more info.

Regards,
Denis

On 1/22/2016 10:07 AM, 姜 为 wrote:
Hi Denis,
        
        I try to use Ignite cache to store the service object.
        The object use Externalizable interface and has a @Autowired field.
        
        When different node use this object, the @Autowired field will be 
null,even @SpringResources on the field.

        The field like JPA interface , it can’t be serialization.

Wei Jiang


在 2016年1月22日,下午2:58,Denis Magda <dma...@gridgain.com> 写道:

Hi,

Spring resource injection is considered to be used only for Ignite Compute Jobs.

It's quite expensive operation to inject a resource for a CacheEntry cause this 
logic will be called for every entry stored in a cache.

Why do you need to inject the resource into a CacheEntry? What do you try to 
achieve?

Regards,
Denis

On 1/22/2016 6:26 AM, 姜 为 wrote:
Hi Igniters,
        
        I’m using Ignite cache store objects.  The object use Externalizable 
interface
         to serialization  and deserialization.
        When object has field use @SpringSource will not inject.

        Should add resource inject to Ignite cache?

        example :

        class Entey implements Externalizable {
           @SpringSource(“springSource")
            private Service service;
public void read… and write...
        }

Reply via email to