You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Native环境下Spring Cloud Function Actuator运行异常求助

问题描述

我有一个基于Spring Cloud Function(Spring Native)运行的Spring应用,通过Cloud Function消费数据,并使用Spring Native原生Docker镜像部署。但添加spring-boot-starter-actuator和spring-boot-starter-web依赖后,应用运行时抛出错误,我希望能追踪绑定器的指标,恳请提供解决方案。

补充信息

  • 非原生镜像运行无问题,仅构建原生Docker镜像运行时出现该问题。
  • Spring Boot Starter Parent版本:3.1.2
  • Spring Cloud版本:2022.0.4
  • GraalVM版本:17
  • Docker镜像构建命令:spring-boot:build-image -P native

代码与配置

消费者代码

@Service("listenPersonData")
public class PersonListener implements Consumer<Person> {

    @Override
    public void accept(Person person) {
        System.out.println("Person Received : " + person.getName());
    }
}

Application.yml配置

spring:
  cloud:
    stream:
      kafka:
        binder:
          replication-factor: 2
      bindings:
        listenPersonData-in-0:
          destination: deneme-person-topic-2
          binder: kafka1
          group: omer-celik-2243
      function:
        definition: listenPersonData;
      binders:
        kafka1:
          type: kafka
          environment:
            spring:
              cloud:
                stream:
                  kafka:
                    binder:
                      brokers: localhost:19092
                      autoCreateTopics: true


management:
  endpoints:
    web:
      exposure:
        include: "*"

reflect-config.json配置

[
  {
    "condition": {
      "typeReachable": "org.springframework.kafka.security.jaas.KafkaJaasLoginModuleInitializer"
    },
    "name": "sun.security.provider.ConfigFile",
    "allPublicConstructors": true
  },
  {
    "name": "org.springframework.cloud.stream.binding.InputBindingLifecycle",
    "allDeclaredFields": true
  },
  {
    "name": "org.springframework.cloud.stream.binding.OutputBindingLifecycle",
    "allDeclaredFields": true
  }
]

错误日志

2023-08-08T17:55:58.544Z  WARN 1 --- [           main] o.s.c.support.GenericApplicationContext  : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'binderClientFactoryCustomizer': Unexpected exception during bean creation
2023-08-08T17:55:58.544Z  WARN 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'inputBindingLifecycle'
2023-08-08T17:55:58.544Z  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2023-08-08T17:55:58.544Z  INFO 1 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'application.errorChannel' has 0 subscriber(s).
2023-08-08T17:55:58.544Z  INFO 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : stopped bean '_org.springframework.integration.errorLogger'
2023-08-08T17:55:58.546Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-08-08T17:55:58.583Z ERROR 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

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

Description:

A component required a bean named 'outerContext' that could not be found.


Action:

Consider defining a bean named 'outerContext' in your configuration.
解决方案

该问题已被排查并修复,对应的修复代码已被Spring Cloud Stream上游合并,并向后移植至4.0.x版本。


内容的提问来源于stack exchange,提问作者eomercelik

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 18:35:13