簡體   English   中英

Spring Boot 2.6 + 集成 - internalPublisherAnnotationBeanPostProcessor 循環依賴

[英]Spring Boot 2.6 + Integration - internalPublisherAnnotationBeanPostProcessor circular dependency

我們已經升級到 2.6 Spring 啟動版本。 我們也在使用 Spring 的集成(org.springframework.boot:spring-boot-starter-integration)。

當我們嘗試啟動應用程序時,我們得到:

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

Description:

The dependencies of some of the beans in the application context form a cycle:

┌──->──┐
|  org.springframework.integration.internalPublisherAnnotationBeanPostProcessor
└──<-──┘

我們能夠使用干凈的 Spring 引導應用程序重現該問題:

DemoApplication.java

package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.config.EnablePublisher;

@EnableIntegration
@EnablePublisher
@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}

build.gradle

plugins {
    id 'org.springframework.boot' version '2.6.1'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

有沒有人暗示 go 可能錯了什么? 可能缺少一些額外的配置

最近已修復: https://github.com/spring-projects/spring-integration/issues/3694

將於下周為即將推出的 Spring Boot 2.6.2發布。

作為一種解決方法,您可以添加此 bean,而不是@EnablePublisher

@Bean(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME)
static PublisherAnnotationBeanPostProcessor publisherAnnotationBeanPostProcessor() {
    return new PublisherAnnotationBeanPostProcessor() {

        @Override
        public void afterPropertiesSet() {

        }

    };
}

問題在於this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class)在其afterPropertiesSet()中。 所以,為了緩解一個循環,我們只需要擺脫它!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM