Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
334 views
in Technique[技术] by (71.8m points)

java - Load external properties with Sping location property with relative path

I wan to divide my application.properties to constant ones inside and compliled with a .jar and the second one which will hold "per server" and runtime changed values out of the .jar in another directory.

I would like to have in example sucha structure:

|
|-configFolder
|  |_application.properties
|
|_projectFolder
  |_app.jar

what I want to achieve is to point spring config location with relative path into that configFolder to load config files. I tried to:

spring:
  config:
    location: file:./../configFolder

but it didn't worked for me.

Do you know if relative paths are possible to use in that place? I would not use absolute directory while I could deploy code on different servers, so relative paths are convenient for me.

question from:https://stackoverflow.com/questions/65866024/load-external-properties-with-sping-location-property-with-relative-path

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...