-
-
Notifications
You must be signed in to change notification settings - Fork 211
Closed
Description
Hi,
In the latest 1.0.9, I am seeing an exception being thrown when creating the config from the ConfigFactory.
Here is the exception:
Caused by: java.lang.UnsupportedOperationException: Can't convert 'file:${my.properties}' to a valid URI
at org.aeonbits.owner.Util.unsupported(Util.java:128)
at org.aeonbits.owner.PropertiesManager.toURIs(PropertiesManager.java:134)
at org.aeonbits.owner.PropertiesManager.<init>(PropertiesManager.java:105)
at org.aeonbits.owner.DefaultFactory.create(DefaultFactory.java:43)
at org.aeonbits.owner.ConfigFactory.create(ConfigFactory.java:66)
... 66 more
Caused by: java.net.URISyntaxException: Expected scheme-specific part at index 5: file:
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.failExpecting(URI.java:2835)
at java.net.URI$Parser.parse(URI.java:3038)
at java.net.URI.<init>(URI.java:595)
at org.aeonbits.owner.ConfigURIFactory.newURI(ConfigURIFactory.java:41)
at org.aeonbits.owner.PropertiesManager.toURIs(PropertiesManager.java:130)
Here is my @sources annotation:
@Sources({"file:${my.properties}", "classpath:conf/${my.env}.my.properties", "classpath:conf/my.properties"})
public interface MyProperties extends Config {
...
}
This used to work fine in previous versions (1.0.5.1), as follows:
- If a system property "my.properties" was defined, it would use it first
- If not, it would try to look for another system property called "my.env", and then load the matching file from the classpath
- finally, if the above was not found, it would try to look for a file at "conf/my.properties" on the classpath
It seems that the system properties used in the @sources cannot be optional... And that's truly annoying!
Please let me know!
Cheers
Metadata
Metadata
Assignees
Labels
No labels