junit单元测试报错
Caused by: java.lang.IllegalStateException: org.springframework.web.context.support.GenericWebApplicationContext@3fb1549b has not been refreshed yet
at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1141)
at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1293)
at com.alibaba.spring.util.BeanUtils.getBeanNames(BeanUtils.java:153)
at com.alibaba.spring.util.BeanUtils.getBeanNames(BeanUtils.java:136)
at com.alibaba.nacos.spring.util.NacosBeanUtils.isBeanDefinitionPresent(NacosBeanUtils.java:207)
at com.alibaba.nacos.spring.util.NacosBeanUtils.registerInfrastructureBeanIfAbsent(NacosBeanUtils.java:174)
at com.alibaba.nacos.spring.util.NacosBeanUtils.registerNacosApplicationContextHolder(NacosBeanUtils.java:285)
at com.alibaba.nacos.spring.util.NacosBeanUtils.registerNacosCommonBeans(NacosBeanUtils.java:372)
at com.alibaba.nacos.spring.context.annotation.NacosBeanDefinitionRegistrar.registerNacosAnnotationBeans(NacosBeanDefinitionRegistrar.java:83)
at com.alibaba.nacos.spring.context.config.xml.NacosAnnotationDrivenBeanDefinitionParser.parse(NacosAnnotationDrivenBeanDefinitionParser.java:49)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1391)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:511)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
... 37 more
Describe what you expected to happen
How to reproduce it (as minimally and precisely as possible)
1.spring.xml 中 import nacos配置
junit单元测试报错 Caused by: java.lang.IllegalStateException: org.springframework.web.context.support.GenericWebApplicationContext@3fb1549b has not been refreshed yet at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1141) at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1293) at com.alibaba.spring.util.BeanUtils.getBeanNames(BeanUtils.java:153) at com.alibaba.spring.util.BeanUtils.getBeanNames(BeanUtils.java:136) at com.alibaba.nacos.spring.util.NacosBeanUtils.isBeanDefinitionPresent(NacosBeanUtils.java:207) at com.alibaba.nacos.spring.util.NacosBeanUtils.registerInfrastructureBeanIfAbsent(NacosBeanUtils.java:174) at com.alibaba.nacos.spring.util.NacosBeanUtils.registerNacosApplicationContextHolder(NacosBeanUtils.java:285) at com.alibaba.nacos.spring.util.NacosBeanUtils.registerNacosCommonBeans(NacosBeanUtils.java:372) at com.alibaba.nacos.spring.context.annotation.NacosBeanDefinitionRegistrar.registerNacosAnnotationBeans(NacosBeanDefinitionRegistrar.java:83) at com.alibaba.nacos.spring.context.config.xml.NacosAnnotationDrivenBeanDefinitionParser.parse(NacosAnnotationDrivenBeanDefinitionParser.java:49) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1391) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:511) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) ... 37 more
Describe what you expected to happen How to reproduce it (as minimally and precisely as possible) 1.spring.xml 中 import nacos配置
nacos-config.xml配置如下 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:nacos="http://nacos.io/schema/nacos" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nacos.io/schema/nacos http://nacos.io/schema/nacos.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">