春季启动必须在应用程序之前创建文件。
我目前正在从事一个Spring Boot项目,并且我们有一个应用程序。Properties文件,该文件定义了一个有2个JKS文件的路径。 (原始文件具有更多的键/值对,但是我重点放在这两个对的主要问题上)
示例
file1.example=folder/file1.jks
file12.example=folder/file2.jks
,但是现在,我需要读取一个包含我需要采用,解码和使用的编码值的环境变量创建这些文件。主要的问题是,我需要在“加载”属性之前创建这两个文件,因为这些文件不存在,如果我不首先构建它们,是否有任何想法?
I'm working currently on a Spring boot project, and we have an application.properties file that defines a path where we have 2 jks files. (the original file has more key/value pairs, but I'm focusing in the main problem with these two pairs)
example
file1.example=folder/file1.jks
file12.example=folder/file2.jks
But now, I need to read an environment variable that contains an encoded value that I need to take, decode and use to create these files. The main problem is that I need to create these two files before the properties are "loaded" because these files do not exist, if I first don't build them, any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常从以下主要方法启动Spring Boot。您可以在调用启动器之前定义静态方法,以便在该方法中使用所需的任何环境变量,并制作I/O操作来准备文件。然后,如果成功完成此操作,则可以让Spring Boot正常启动服务器和应用程序。
Normally Spring boot launches from the following main method. You can define a static method before the launcher is called so that in that method you use whatever environment variable you want and make I/O operations to prepare the files. Then if this is done successfully you can let Spring Boot start the server and application normally.