简体   繁体   English

Spring 启动应用程序,使用两个服务之间的值/状态

[英]Spring Boot applications, using a value/state between 2 services

I have 2 Spring Boot applications let's say named Application1 and Application2 .我有 2 个Spring 启动应用程序,假设名为Application1Application2 I have a state/mode/status whatever you call it in Application2 , whose value should be ON when Application1 runs a scheduler and will be OFF when it's stopped.我有一个状态/模式/状态,无论您在Application2中如何称呼它,其值在Application1运行调度程序时应为 ON,而在它停止时应为 OFF。 This status value should be singleton in Application2 .此状态值在Application2中应为 singleton。

How can Application1 change the status value(Singleton) in Application2 . Application1如何更改Application2中的状态值(Singleton)。

Please help me How can I implement it in Spring Boot ?请帮助我如何在Spring Boot中实现它?

Implement a rest service say getStatus() in Applicaton1 which will be providing the status of the scheduler (ON or OFF Status).Applicaton1中实施 rest 服务getStatus() ,它将提供调度程序的状态(ON 或 OFF 状态)。 getStatus() can be called from Application2 using RestTemplate .可以使用RestTemplateApplication2调用getStatus()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM