基于 Spring 的 Web 应用程序:现有:从文件(“web.xml”)加载上下文,应用程序所需的属性从 xml 上下文文件中引用的属性文件加载。
新:现在应该从 zookeeper 读取属性(连同属性文件)。使用 ZookeeperPropertySource 完成读取属性所需的 java 代码
问题:我需要在哪里插入java代码,以便从zookeeper加载属性以及应用程序上下文的初始化?
我无法使用 ApplicationEventListener (因为 ContextStartedEvent 不会自动触发)和 BeanFactoryPostProcessor (环境无法绑定属性)来实现这一点