如何将Ignite与Spring Boot一起使用?我用Google搜索但没有成功。有没有人体验过Spring Boot和Ignite的组合?
这是使用Spring Boot运行Ignite的正确方法吗? Apache Ignite Loading Twice with Spring-Boot?
答案 0 :(得分:2)
目前现在已经与Spring Boot直接集成,因此您应该使用Ignition.start()
方法手动启动应用程序中的节点。
答案 1 :(得分:2)
我有测试项目春季启动+点燃。我希望这会有所帮助: github project
答案 2 :(得分:1)
对于我的用例,我创建一个bean并在返回点燃之后开始点燃它。它会在开始时点燃一次。
答案 3 :(得分:0)
Use following steps to integrate ignite with spring boot.
1. Add following dependency in POM.xml file
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring-data</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${ignite.version}</version>
</dependency>
2. Create the Ignite bean instance
@Bean
public Ignite igniteInstance() {
IgniteConfiguration cfg = new IgniteConfiguration();
Ignite igniteInst= Ignition.start(cfg);
return igniteInst;
}
3. Configure the repository
@RepositoryConfig(cacheName = "cacheName")
public interface RepositoryName extends IgniteRepository<V, K> {
}
4. Autowired the RepositoryName interface which extends the IgniteRepository in service layer
@Component
public class ServiceImpl
@Autowired
RepositoryName repositoryName;
}
5. You can use 5th steps apart from 4th steps to inject the ignite bean in service layer
@Component
public class ServiceImpl {
@Autowired
Ignite ignite;
void abcMethod(){
IgniteCache<K, V> igniteCache = ignite.cache("CacheName");
}
}
&#13;