spring remote loading spring configuration file -- problem

Now doing the thing of dynamically loading spring remote config files.
Specifically, after the web project is started, the spring configuration file
(spring-rabbitmq.xml) needs to be dynamically obtained from other systems, and it needs to be dynamically loaded into spring's ApplicationContext.
Why do it? Because I am doing a message center (sub-server and client), I
need the client to get the rabbitmq message configuration from the server.
In the client spring, you need to configure spring-rabbitmq.xml to easily obtain the corresponding messages in the queue
. (The corresponding queue name is dynamically generated according to the message properties registered in the message center).
So I thought of dynamically obtaining spring-rabbitmq.xml from the client and writing it into the spring configuration of the corresponding client,
and then I can freely use the corresponding RabbitTemplate to operate the corresponding message.
But now I try to use InitializingBean, DisposableBean, BeanPostProcessor, etc.,
but it can't work as I imagined
(project startup, spring startup, spring loading remote configuration file, spring startup is complete,
you can directly use @Autowired to get RabbitTemplate, which can be directly consumed or send message) into the project.
The difficulty now is that when I get the remote configuration file and write it to the spring configuration folder,
it fails to get the RabbitTemplate in @Autowired on the client, and the system reports an error.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326862372&siteId=291194637