在凭据更改后,是否可以在Springboot中再次在Springboot中以编程方式重新运行@configuration类?

发布于 2025-01-27 09:37:04 字数 147 浏览 1 评论 0 原文

我有一个@configuration类,该类在RESTTEMPLATE中的登录凭据设置为另一个Spring应用程序的标题。 现在,当其他应用程序重新启动时,凭据不再有效。

因此,问题是,当凭据不再有效时,是否可以通过编程方式再次运行此@configuration类?

I have a @Configuration class which sets the header with the login credentials in RestTemplate for another spring application.
Now when the other application restarts, the credentials are not valid anymore.

So the question is if it is possible to run this @Configuration class again programmatically when credentials are not valid anymore?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉南桥 2025-02-03 09:37:04

检查下面的文章是否有帮助!

  1. 上下文这篇文章似乎相关吗?

  2. ? “ rel =“ nofollow noreferrer”> https://javapointers.com/spring/spring-boot/how-to-restart/how-to-restart-spring-boot-boot-automation-using-actuator/ (您可以使用执行器从另一个应用程序触发重新启动的终点:p ,尽管现在推荐的解决方案)

Check if below articles help !

  1. https://www.baeldung.com/java-restart-spring-boot-app

  2. Programmatically restart Spring Boot application / Refresh Spring Context (Does this article seem relevant? )

  3. https://javapointers.com/spring/spring-boot/how-to-restart-spring-boot-automatically-using-actuator/ (You can use actuator end point from another application to trigger a restart :P Although now recommended solution)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文