【问题标题】:@EnableBinding(Source.class) throws Failed to bind properties under 'server.error.include-stacktrace' to org.springframework.boot.autoconfigure.web@EnableBinding(Source.class) throws Failed to bind properties under 'server.error.include-stacktrace' to org.springframework.boot.autoconfigure.web
【发布时间】:2019-08-29 15:11:11
【问题描述】:

Spring Cloud Stream 和 kafka。

添加以下依赖项后出现此错误。 (如果我注释掉 @EnableBinding(Source.class) 一切正常。)

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-kafka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream</artifactId>
        </dependency>

当我添加启用绑定属性时,

@SpringBootApplication
@EnableBinding(Source.class)
public class CustomersServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(CustomersServiceApplication.class, args);
    }
}

这些是我的属性

spring:
  application:
    name : customerservice
  cloud:
    stream:
      bindings:
        output:
            destination:  orgChangeTopic
            content-type: application/json
      kafka:
        binder:
          zkNodes: localhost
          brokers: localhost

logging:
  level:
    com.netflix: WARN
    org.springframework.web: WARN
    com.thoughtmechanix: DEBUG


eureka:
  instance:
    preferIpAddress: true
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
        defaultZone: http://localhost:8761/eureka/


server:
  port: 7000

这是我的完整代码,但是当我现在运行应用程序时,我遇到了错误。

2019-04-08 15:40:33.325  INFO 22917 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-08 15:40:33.336 ERROR 22917 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'server.error.include-stacktrace' to org.springframework.boot.autoconfigure.web.ErrorProperties$IncludeStacktrace:

    Property: server.error.include-stacktrace
    Value: ALWAYS
    Origin: "server.error.include-stacktrace" from property source "devtools"
    Reason: 0

Action:

Update your application's configuration

将属性添加到我的属性文件后。我仍然得到同样的错误

server:
  port: 7000
  error:
    include-stacktrace : ALWAYS

【问题讨论】:

    标签: spring-boot spring-cloud spring-cloud-stream spring-kafka


    【解决方案1】:

    看起来像春季版本冲突问题。这里有两个建议:

    1. 使用 Kafka 项目创建一个干净的 Spring Cloud Stream,以确保其正常运行。
    2. 使用mvn依赖树分析spring版本冲突。

    【讨论】:

      猜你喜欢
      • 2013-12-28
      • 2013-08-03
      • 2013-08-31
      • 2013-02-05
      • 2020-01-15
      • 1970-01-01
      • 2021-07-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多