@ExtendWith(SpringExtension.class)
@SpringBootTest
@TestPropertySource(locations = "classpath:test.properties")
@EmbeddedKafka(partitions = 1,
topics = {"topic"},
brokerProperties = {
"auto.create.topics.enable=${topics.autoCreate:false}",
"delete.topic.enable=${topic.delete:true}",
"broker.id=2"})
它在大多数情况下都有效。
但是
有时
java.lang.IllegalStateException异常:未能在处加载ApplicationContext
...
在
在
java.base/java.util.concurrent.ThreadPoolExecutor线程池执行器$工人.run(ThreadPoolExecutor.java:628)
在
org.gradle.internal内部.并发.ThreadFactoryImpl百万美元anagedThreadRunnable.run运行(ThreadFactoryImpl.java:55个)
org.springframework.beans网站.factory.BeanCreationException异常:错误
创建名为“embeddedKafka”的bean:init方法的调用
org.apache.zookeeper网站.KeeperException$SessionExpiredException:异常:
keeperrorcode=会话在处过期
在
org.springframework.beans网站.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(抽象)reCapableBeanFactory.java:410)
在
在
org.springframework.boot启动.test.context.SpringBootContextLoader$续extCustomizerAdapter.initialize(Spr)ingBootContextLoader.java:320)
在
org.springframework.boot启动.SpringApplication.prepareContext文件(SpringApplication.java:373)
在
org.springframework.boot启动.SpringApplication.run(SpringApplication.java:314)
org.springframework.boot启动.test.context.SpringBootContextLoader.loadContext(Spr)ingBootContextLoader.java:127)
在
org.springframework.test测试.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(默认缓存awarecontextLoaderDelegate.java:99)
在
org.springframework.test测试.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareC)ontextLoaderDelegate.java:117)
org.apache.zookeeper网站.KeeperException$SessionExpiredException:异常:
keeperrorcode=会话在处过期
在
卡夫卡.zk.KafkaZkClient.checkedEphemeralCreate创建(KafkaZkClient.斯卡拉:1631)
在卡夫卡.zk.KafkaZkClient.注册代理(KafkaZkClient.斯卡拉:87)在
卡夫卡.utils.TestUtils$.createServer(TestUtils.scala:132个)在
卡夫卡.utils.TestUtils.创建服务器(测试工具.scala)在
org.springframework.kafka网站.测试.embedded kafkabroker.afterproperties设置(嵌入式kafkabroker.java:215)
在
org.springframework.beans网站.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowi)reCapableBeanFactory.java:1804年)
在
org.springframework.beans网站.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(抽象)reCapableBeanFactory.java:1741)
... 82人以上
任何帮助都将不胜感激。