我已将Spring Boot(2.0.3)与Apache ignite(2.7)集成在一起,同时以嵌入式模式启动apache ignite,它在创建bean时抛出 Null Pointer Exception 。
通过分析,我能够找出问题所在。 Spring Boot(2.0.3)内部依赖于spring(5.0.7)和Apache Ignite依赖于spring(4.3.18)。 在为 ignite.cfg 创建bean时,由于 pom.xml 中的优先级,apache ignite引用了spring(5.0.7),并且抛出了空指针异常。
我尝试过的解决方案 1.我在 pom.xml 的开头将 ignite依赖项移到了Spring Boot依赖项之上,该问题解决了ignite问题,但是正在为Spring Boot(2.0 .3),因为使用了较旧的spring(4.3.18)版本
please find the below pom
-----------------------------------------------------
<dependencies>
<!-- Apache Ignite For Cache -->
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.195</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.7.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.0.7.Final</version>
</dependency>
<!-- spring-boot web dependency -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<!-- spring-boot thymeleaf dependency -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<!-- spring-boot jpa dependency -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.0.3.RELEASE</version>
<scope>test</scope>
</dependency>
-------------------------------------------------
I need suggestion on below points to tackle the above mentioned scenario.
1.Is apache ignite supports spring (5.x) versions, so that i can exclude dependency from apache-ignite and it can use spring dependency from spring boot ?
Or any other suggestions to tackle this isssue ?