在 Spring Boot 中使用 javascript 获取 application.properties 文件中的值

Man*_*iki 5 html javascript properties-file spring-boot

在我的index.html 页面中,脚本中的变量是硬编码的。我想从 application.properties 文件中获取它,但不知道如何获取。如果有人能为我提供解决方案,那将会很有帮助。

dan*_*ten 0

我将创建一个 RestController 来公开 ConfigurationProperties。但请务必妥善保护它并限制其范围,以免泄露数据库访问凭据等机密数据。