Skip to content

Commit

Permalink
Merge pull request #597 from kubukoz/patch-1
Browse files Browse the repository at this point in the history
Add a note about classloader issues to README
  • Loading branch information
havocp authored Nov 4, 2018
2 parents 62b20cc + d5f9311 commit 1fc2aff
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,15 @@ If you have trouble with your configuration, some useful tips.
string with comments showing where each value came from.
This string can be printed out on console or logged to
a file etc.
- If you see errors like
`com.typesafe.config.ConfigException$Missing: No configuration setting found for key foo`,
and you're sure that key is defined in your config file, they might appear e.g.
when you're loading configuration from a thread that's not the JVM's main thread.
Try passing the `ClassLoader` in manually - e.g. with `ConfigFactory.load(getClass().getClassLoader())`
or setting the context class loader.
If you don't pass one, Lightbend Config uses the calling thread's `contextClassLoader`, and in some cases,
it may not have your configuration files in its classpath,
so loading the config on that thread can yield unexpected, erroneous results.

### Supports Java 8 and Later

Expand Down

0 comments on commit 1fc2aff

Please sign in to comment.