Spring Boot +弹性搜索+ Maven

时间:2018-05-09 09:59:50

标签: spring-boot

我正在尝试使用简单的spring boot应用程序来连接弹性搜索。我在ApplicationContext上启动应用程序时遇到了问题。

它显示如下

  

错误    在上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.BeanCreationException:在类路径资源中定义名称为'requestMappingHandlerMapping'的bean时出错[org / springframework / boot / autoconfigure / web / servlet / WebMvcAutoConfiguration $ EnableWebMvcConfiguration。 class]:调用init方法失败;嵌套异常是java.lang.IllegalStateException:不明确的映射。无法映射'studentController'方法   public java.util.Optional com.springboot.main.StudentController.getStudent(long)   to {[/ student],methods = [GET]}:已经有'studentController'bean方法   public com.springboot.main.Student com.springboot.main.StudentController.show(long,java.lang.String,int)mapping。   2018-05-09 16:14:50.512 INFO 24984 --- [main] o.apache.catalina.core.StandardService:停止服务[Tomcat]   2018-05-09 16:14:50.552 INFO 24984 --- [main] ConditionEvaluationReportLoggingListener:   启动ApplicationContext时出错。要显示条件报告,请在启用“debug”的情况下重新运行应用程序。   2018-05-09 16:14:50.559 ERROR 24984 --- [main] o.s.boot.SpringApplication:应用程序运行失败

下面

  

我的Pom.xml文件

http://maven.apache.org/xsd/maven-4.0.0.xsd">     4.0.0

<groupId>com.springboot</groupId>
<artifactId>springboot_elastic</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>springboot_elastic</name>
<description>Demo project for Spring Boot</description>

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

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency> 
        <dependency>
        <groupId>net.java.dev.jna</groupId>
        <artifactId>jna</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>

</dependencies>
  

请帮我解决这个问题

0 个答案:

没有答案