Reputation: 727
I am having some troubles in order to specify the absolute path of some resources in the application.yml of my spring boot app.
Using relative path works ok, I place those files under src/main/resources/key with the following configuration:
public: encryption: key: keys\encrypt\public_enc_asn1.key decryption: key: keys\decrypt\public_dec_asn1.key private: decryption: key: keys\decrypt\private_dec_asn1.key
I am using windows. I put the same files under C:\test\ with the following configs in application.yml but they are not working:
public: encryption: key: C:\test\encrypt\public_enc_asn1.key decryption: key: C:\test\decrypt\public_dec_asn1.key private: decryption: key: C:\test\decrypt\private_dec_asn1.key
How can I specify a windows absolute path in application.yml? I also tried with ${user.home}
option but no luck.
Upvotes: 4
Views: 41429
Reputation: 21
I was working on a project on Kafka with spring boot and was getting error when provided an absolute path. As mentioned above, I tried alexbt's solution using single quotes but it did not work for me.
Adding file:\
at the beginning of the path with single quotes worked just fine.
ssl:
trust-store-location: 'file:\F:\Spring-boot-projects\Kafka\ssl\client.truststore.jks'
trust-store-password: 12345678
key-store-location: 'file:\F:\Spring-boot-projects\Kafka\ssl\client.keystore.jks'
key-store-password: 12345678
Upvotes: 2
Reputation: 17045
The error is due to colon in your values (as in C:\test\...
). You need to surround your value with quotes:
public:
encryption:
key: 'C:\test\encrypt\public_enc_asn1.key'
decryption:
key: 'C:\test\decrypt\public_dec_asn1.key'
private:
decryption:
key: 'C:\test\decrypt\private_dec_asn1.key'
Upvotes: 10