When writing the Ignite service, the service is typically configured in the startup file:
class= "Org.apache.ignite.services.ServiceConfiguration" > <property name= "name" value= "***impl "/> <property name=" Maxpernodecount "value=" 1 "/> <property name=" TotalCount "value=" 1 "/> <property name= "service" > <ref bean= "Cronserviceimpl"/> </property> class = "Com.***impl" ></bean>
Classes injected in the implementation class
@Autowired private ctsmgr ctsmgr;
According to Spring's habit we inject interfaces usually choose @autowired or @resource,ignite is also compatible with spring. But when the deployment of the service occurs after the startup, that is, when the service is not configured in the configuration file:
New serviceconfiguration (); Cfg.settotalcount (4); Cfg.setmaxpernodecount (2); Cfg.setname ("***impl"); Cfg.setservice (new ***impl ()); Ignition.ignite (). Services (). deploy (CFG);
At this point, the service will find that the ctsmgr is null, it is necessary to use the Ignite annotation, the interface injection is replaced by:
@SpringResource (resourcename = "Ctsmgr") privatetransient ctsmgr ctsmgr;
You can see that the code is working again.
The bean injected into the ignite service is empty