BeanFactory not initialized or already closed - call 'refresh' before

后端 未结 10 1596
無奈伤痛
無奈伤痛 2020-12-10 01:23

here is my error:

I am getting this error , can any one help me on this.

> SEVERE: Exception sending context initialized event to listener
> i         


        
10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 01:47

    In my case, the error was valid and it was due to using try with resource

     try (ConfigurableApplicationContext cxt = new ClassPathXmlApplicationContext(
                        "classpath:application-main-config.xml")) {..
    }
    

    It auto closes the stream which should not happen if I want to reuse this context in other beans.

提交回复
热议问题