We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My java Code to read a role in the property-file:
class ConfigIO { private final transient Supplier<Config> cfg = new Once<>(ConfigFactory::load); @PostConstruct private void init() { cfg.get(); } public Optional<String> getRole(String userName) { String path = String.format("roles.\"%s\"", userName); if (!cfg.get().hasPath(path)) { return Optional.empty(); } return Optional.of(cfg.get().getString(path)); }
With this call:
new ConfigIO().getRole("test@test.com")
Here a part of my test.properties:
roles."test@test.com"="admin" roles."testA@test.com"="editor"
Method threw com.typesafe.config.ConfigException$Missing exception.
com.typesafe.config.ConfigException$Missing
How can i read this property with Quotes?
The text was updated successfully, but these errors were encountered:
I believe .properties files don't have any special meaning for quotes; here is the spec: https://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.Reader)
If you do a cfg.render() you can see how the properties have been parsed and adapt accordingly. You may find it less confusing to use ConfigObject.get (cfg.root.get("roles").get("\"test@test.com\"") perhaps) since it avoids also having to escape through the path syntax. See https://lightbend.github.io/config/latest/api/com/typesafe/config/ConfigObject.html#get-java.lang.Object-
cfg.render()
ConfigObject.get
cfg.root.get("roles").get("\"test@test.com\"")
Note section "paths, keys, and Config vs ConfigObject" in https://lightbend.github.io/config/latest/api/com/typesafe/config/Config.html
Sorry, something went wrong.
No branches or pull requests
My java Code to read a role in the property-file:
With this call:
new ConfigIO().getRole("test@test.com")
Here a part of my test.properties:
Method threw
com.typesafe.config.ConfigException$Missing
exception.How can i read this property with Quotes?
The text was updated successfully, but these errors were encountered: