首页 > 解决方案 > 使用 Flink 的 Spring Boot Gradle 项目不起作用

问题描述

我有一个使用 LogBack 日志的 Spring Boot Gradle 项目。我希望它支持 Flink,但 Flink 使用的是 Log4j。当我开始这个项目时,它就一直这样。两者结合时不起作用。

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation 'org.slf4j:log4j-over-slf4j:1.7.25'
    implementation 'org.apache.kafka:kafka-clients:2.1.0'
    implementation 'org.apache.flink:flink-java:1.7.2'
    implementation 'org.apache.flink:flink-streaming-java_2.12:1.7.2'
    implementation 'org.apache.flink:flink-connector-kafka-0.10_2.12:1.7.2'
}
2019-04-03 11:40:20.788 [main] 
INFO com.example.server.flinkkafkademo03.FlinkKafkaDemo03Application [SpringApplication.java:679] - The following profiles are active: dev 
2019-04-03 11:40:23.798 [flink-akka.actor.default-dispatcher-5] 
INFO akka.event.slf4j.Slf4jLogger [Slf4jLogger.scala:92] - Slf4jLogger started 2019-04-03 11:40:23.879 [flink-metrics-2] 
INFO akka.event.slf4j.Slf4jLogger [Slf4jLogger.scala:92] - Slf4jLogger started 
WARNING: An illegal reflective access operation has occurred 
WARNING: Illegal reflective access by org.apache.flink.core.memory.HybridMemorySegment (file:/E:/Program%20Files/gradle-5.0/repository/caches/modules-2/files-2.1/org.apache.flink/flink-core/1.7.2/184443282d6269261e2783d5797d2aafbe88253/flink-core-1.7.2.jar) to field java.nio.Buffer.address 
WARNING: Please consider reporting this to the maintainers of org.apache.flink.core.memory.HybridMemorySegment 
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations 
WARNING: All illegal access operations will be denied in a future release

标签: javaspring-bootapache-flinkslf4j

解决方案


推荐阅读