升級springboot支持elasticsearch2.x版本

在springboot 1.4以前,若是使用spring data elasticsearch 2.x版本,則啓動會報錯,由於springboot1.4版本以前依賴的es是1.x版本的。在1.4版本出來以前,尚不能使用es2.x版本。html

升級到springboot1.4

parent

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.M3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

非release版

<!-- Add Spring repositories -->
    <!-- (you don't need this if you are using a .RELEASE version) -->
    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <url>http://repo.spring.io/snapshot</url>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <url>http://repo.spring.io/milestone</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <url>http://repo.spring.io/snapshot</url>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <url>http://repo.spring.io/milestone</url>
        </pluginRepository>
    </pluginRepositories>

spring-data-elasticsearch2.x

<!-- http://mvnrepository.com/artifact/org.springframework.data/spring-data-elasticsearch -->
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>2.0.1.RELEASE</version>
        </dependency>

參考

相關文章
相關標籤/搜索