【问题标题】:How to specify path location of files inside SpringBoot property file如何在 Spring Boot 属性文件中指定文件的路径位置
【发布时间】:2018-08-06 14:05:31
【问题描述】:

这是我的 spring boot 应用程序中定义的 2 个值,它们位于 resources/config/application-dev.properties 中。

TLS.store.location=/app/eas/certs/cics.jks
logging.file=/app/eas/logs/easApp.log

并且 jks 密钥存储位置在 spring-context xml 中访问如下:

<sec:keyStore type="${TLS.store.type}" password="${TLS.store.pass}"
                          file="${TLS.store.location}" />

虽然日志文件生成得非常好,但没有按预期检测到 TLS.store.location 值。 cics jks 文件位于根文件夹中(现在是 windows - c:\app\eas\certs\cics.jks)

我运行我的应用程序如下:java -jar -Dspring.profiles.active=dev target/test.jar

日志文件错误如下:

`Could not resolve placeholder 'TLS.store.location' in value "<sec:trustManager``

由于仅针对 TLS.location.store 引发错误 - 我猜它无法按预期访问文件位置?

如何解决这个问题?

【问题讨论】:

  • 试试file:app/eas/certs/cics.jks
  • 类路径:${TLS.store.location}
  • 抱歉 - 两个选项都没有按预期工作。

标签: spring spring-boot properties configuration-files


【解决方案1】:

已解决。主要与 jar 冲突有关!!

依赖模块有一个单独的 springwebmvc 依赖项,而父 springboot 应用程序有另一个版本。

一旦我以统一的方式创建了所有依赖项,它就会开始按预期工作。

【讨论】:

    猜你喜欢
    • 2016-04-25
    • 2020-06-05
    • 1970-01-01
    • 2015-01-23
    • 2010-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多