@EnableBinding(Source.class) throws Failed to bind properties under 'server.error.include-stacktrace' to org.springframework.boot.autoconfigure.web

时间:2019-04-08 12:51:29

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

Spring Cloud Stream and kafka.

This error shows up after I add the following dependencies. ( If I comment out the @EnableBinding(Source.class) everything works. )

<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>

When I add the Enable Binding property,

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

And these are my properties

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

This is my full code, however when I run the application now, I am getting an error.

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

After Adding the property to my properties file. I still get the same error

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

1 个答案:

答案 0 :(得分:0)

似乎是春季版本冲突问题。这里有两个建议:

  1. 使用Kafka项目创建干净的Spring Cloud流,以确保其正常运行。
  2. 使用mvn依赖关系树分析冲突的春季版本。