我尝试通过弹簧启动2.6.0
实现点燃2.1.0.RELEASE
,但是当我全新安装代码时,出现以下异常:
name clash: deleteAll(java.lang.Iterable<ID>) in org.apache.ignite.springdata.repository.IgniteRepository and deleteAll(java.lang.Iterable<? extends T>) in org.springframework.data.repository.CrudRepository have the same erasure, yet neither overrides the other
这是关于Maven Projet的,这是依赖项:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-slf4j</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring-data</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>2.6.0</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
</dependencies>
点燃配置类
@Configuration
@EnableIgniteRepositories
public class IgniteConfig {
@Bean
public Ignite igniteInstance() {
IgniteConfiguration config = new IgniteConfiguration();
CacheConfiguration<String, MyEntity> cacheMyEntity = new CacheConfiguration<>("MyEntityCach");
cacheMyEntity.setIndexedTypes(String.class, MyEntity.class);
CacheConfiguration[] cacheConfiguration= new CacheConfiguration[] {cacheMyEntity};
config.setCacheConfiguration(cacheConfiguration);
return Ignition.start(config);
}
}
存储库
@RepositoryConfig(cacheName = "MyEntityCach")
public interface EntityRepository extends IgniteRepository<MyEntity, String>{}
实体
@Getter
@Setter
@Builder
public class MyEntity implements Serializable{
@QuerySqlField(index = true)
private String id;
@QuerySqlField()
private String label;
@QuerySqlField()
private Long number;
@QuerySqlField(index = true)
private Long idParent
}
好吧,我不使用任何方法删除,所以为什么它给了我这个例外!版本冲突在某些地方吗? 你有什么主意吗?
答案 0 :(得分:1)
我也尝试对Ignite 2.6和Spring Boot 2.1.0进行相同操作,但IgniteReposities也不起作用。我很确定Ignite Spring Data 2.6模块不支持Spring 5。
作为解决方法,我在类Dao中使用SqlQuery访问数据,例如:
array([['beef', 'bread', 'cane_molasses'],
['brassica', 'butter', 'cardamom']])
答案 1 :(得分:1)
您需要使用ignite-spring-data_2.0代替ignite-spring-data:
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring-data_2.0</artifactId>
<version>${ignite.version}</version>
</dependency>
这适用于spring-boot 2.1.6.RELEASE并点燃2.7.5