2

嗨,我正在使用 Spring Boot 2.1.2 和 Ignite 2.7.0

我有带有查询方法的 CRUD Ignite 存储库

@RepositoryConfig(cacheName = SmartConstants.IGNITE_ISSUE_DETAILS_CACHE)
public interface IgniteIssueDetailsRepository extends IgniteRepository<IgniteIssueDetails,Long>{

    List<IgniteIssueDetails> findAllByProjectName(String projectName);
    Long countByProjectNameAndResolution(String projectName,String resolution);
    Long countByProjectName(String projectName);
}

错误 :

引起:java.lang.IllegalStateException:您在存储库中定义了查询方法,但您没有定义任何查询查找策略。基础设施显然不支持查询方法!

我知道这是由于 spring data commons 从 2.0.X 更改为 2.1.X 但找不到 ignite 的解决方案

Ignite 2.7 仍然有旧的方法定义

 @Override protected QueryLookupStrategy getQueryLookupStrategy(final QueryLookupStrategy.Key key,
        EvaluationContextProvider evaluationCtxProvider) {

这不符合新的 Spring Data Commons 定义

@Override
    protected Optional<QueryLookupStrategy> getQueryLookupStrategy(@Nullable Key key,
            QueryMethodEvaluationContextProvider evaluationContextProvider) {

我尝试包含多个版本的公地,但不断收到其他错误。

如果我使用像 findAll() 这样的预加载方法,它工作正常!!

我们有任何可以帮助我的 spring-data-commons 版本吗:(

主弹簧应用:

@SpringBootApplication
@EnableCaching
@EnableAsync
@EnableScheduling
@EnableIgniteRepositories(value="com.fico.ps.smart.model.ignite.repository",queryLookupStrategy = Key.CREATE)
@EnableJpaRepositories("com.fico.ps.smart.model.onboarding.repository")
public class Application extends SpringBootServletInitializer {

我的依赖:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-to-slf4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-commons</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.hibernate.validator</groupId>
                <artifactId>hibernate-validator</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.17</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.17</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j2</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-jul</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j-impl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20180813</version>
    </dependency>   
    <!-- https://mvnrepository.com/artifact/org.codehaus.jackson/jackson-mapper-asl -->
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.5.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.taglibs/taglibs-standard-impl -->
    <dependency>
        <groupId>org.apache.taglibs</groupId>
        <artifactId>taglibs-standard-impl</artifactId>
        <version>1.2.5</version>
    </dependency>
    <dependency>
        <groupId>org.tmatesoft.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.9.3</version>
    </dependency>
    <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.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-spring-data</artifactId>
        <version>2.7.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-commons</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-indexing</artifactId>
        <version>2.7.0</version>
    </dependency>
     <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-slf4j</artifactId>
        <version>2.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>
4

4 回答 4

2

我也遇到了上述问题。此问题在 Apache Ignite 2.8.1 中已解决,具有 ignite-spring-data_2.2 依赖项。

请使用以下 Maven 依赖项

    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-spring-data_2.2</artifactId>
        <version>2.8.1</version>
    </dependency>
于 2020-06-28T15:08:20.063 回答
2

我设法通过以下依赖项配置解决了这个错误:

    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-spring-data_2.0</artifactId>
        <version>2.7.5</version>
        <exclusions>
            <!-- org.apache.ignite.springdata20.repository.support.IgniteRepositoryFactory depends in 2.0.x -->
            <exclusion>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-commons</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- This is the latest version in the 2.0.x stream -->
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>2.0.14.RELEASE</version>
    </dependency>
于 2019-07-14T10:23:27.380 回答
1

我找到了解决方案。

问题是支持spring boot 2.0.X ignite 有特殊的_2.0 spring 数据库。它仅支持 2.7.0。

<dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-spring-data_2.0</artifactId>
            <version>${ignite.version}</version>
        </dependency>

在此查询方法工作正常之后:)

于 2019-01-31T18:04:46.493 回答
0

正如布鲁斯所说,spring-data-commons 的 2.0.14.RELEASE 版本是唯一有效的版本。我尝试了这个较新的版本,也得到了错误!

<dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-spring-data_2.0</artifactId>
        <version>${ignite.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-commons</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>2.1.6.RELEASE</version>
    </dependency>
于 2019-07-31T15:01:04.427 回答