-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.6.0使用demo样例代码无法启动,报各种错 #4
Comments
新版本还没进行调试 太忙了
…---- 回复的原邮件 ----
| 发件人 | Star ***@***.***> |
| 日期 | 2022年09月08日 00:00 |
| 收件人 | ***@***.***> |
| 抄送至 | ***@***.***> |
| 主题 | [hiwepy/disruptor-spring-boot-starter] 2.6.0使用demo样例代码无法启动,报各种错 (Issue #4) |
spring boot 2.6.0 按你给到的版本运行sample时:
Description:
Parameter 2 of method disruptor in com.lmax.disruptor.spring.boot.DisruptorAutoConfiguration required a single bean, but 2 were found:
- applicationTaskExecutor: defined by method 'applicationTaskExecutor' in class path resource [org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.class]
- taskScheduler: defined by method 'taskScheduler' in class path resource [org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.class]
按程序提示手动加入:
@primary
@bean(
name = {"applicationTaskExecutor", "taskExecutor"}
)
@ConditionalOnMissingBean({Executor.class})
public ThreadPoolTaskExecutor applicationTaskExecutor(TaskExecutorBuilder builder) {
return builder.build();
}
又报错:
***************************
APPLICATIONFAILEDTOSTART
***************************
Description:
Thedependenciesofsomeofthebeansintheapplicationcontextformacycle:
┌─────┐
| disruptorConfig (fieldprotectedcom.lmax.disruptor.dsl.Disruptorcom.lmax.disruptor.spring.boot.config.DisruptorConfig.disruptor)
↑ ↓
| disruptordefinedinclasspathresource [com/lmax/disruptor/spring/boot/DisruptorAutoConfiguration.class]
└─────┘
于是关掉循环依赖:
main:
allow-circular-references: true
allow-bean-definition-overriding: true
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'disruptorConfig': Bean with name 'disruptorConfig' has been injected into other beans [applicationTaskExecutor] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesForType' with the 'allowEagerInit' flag turned off, for example.
请问哥们是怎么跑起来的?我试了半天都不行?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@qinxingnet @Bean()
@ConditionalOnMissingBean(name="disruptorThreadFactory")
public ThreadFactory disruptorThreadFactory() {
return new DisruptorEventThreadFactory();
}
@Bean
@ConditionalOnClass({ Disruptor.class })
@ConditionalOnProperty(prefix = DisruptorProperties.PREFIX, value = "enabled", havingValue = "true")
public Disruptor<DisruptorEvent> disruptor(
DisruptorProperties properties,
WaitStrategy waitStrategy,
@Qualifier("disruptorThreadFactory")
ThreadFactory threadFactory,
EventFactory<DisruptorEvent> eventFactory,
@Qualifier("disruptorEventHandlers")
List<DisruptorEventDispatcher> disruptorEventHandlers) {
由于 @ConditionalOnMissingBean 啥也不写,默认是按照接口来判断的,所以这边没有创建,但是那边会有俩提供者 "applicationTaskExecutor", "taskExecutor" |
@hiwepy 多谢回复,我看和这个issues重复了,在这里写了下我的修改之处,不知道对不对,请大佬指正。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
spring boot 2.6.0 按你给到的版本运行sample时:
按程序提示手动加入:
又报错:
于是关掉循环依赖:
还是报错:
请问哥们是怎么跑起来的?我试了半天都不行?
The text was updated successfully, but these errors were encountered: