我們已經升級到 2.6 Spring boot 版本。我們也在使用 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 啟動應用程式重現該問題:
演示應用程式.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);
}
}
構建.gradle
plugins {
id 'org.springframework.boot' version '2.6.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
有沒有人暗示可能會出什么問題?也許缺少一些額外的配置
uj5u.com熱心網友回復:
最近已修復:https : //github.com/spring-projects/spring-integration/issues/3694。
將于下周為即將推出的 Spring Boot 發布2.6.2。
作為一種解決方法,@EnablePublisher您可以添加此 bean:
@Bean(IntegrationContextUtils.PUBLISHER_ANNOTATION_POSTPROCESSOR_NAME)
static PublisherAnnotationBeanPostProcessor publisherAnnotationBeanPostProcessor() {
return new PublisherAnnotationBeanPostProcessor() {
@Override
public void afterPropertiesSet() {
}
};
}
問題在于它this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class)的afterPropertiesSet(). 因此,為了減輕回圈,我們只需要擺脫它!
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/384513.html
上一篇:Graphics2D:在Java中從JSON繪制多行字串
下一篇:如何在Java中字串化投影屬性?
