Hi again,

thank you all for your kind advice!

My responses follow:

@Josh: This "lazy" approach didn't work for me anyhow. I got just the same 
NPEs. This really is kind of non-deterministic as it sometimes would work and 
sometimes it wouldn't. I mean the whole 
access-the-servlet-context-while-startup-thing.

@Mark: Yes, I know the possibility to give symbol values through web.xml but it 
just doesn't feel right to mess with development configuration at such an 
important and central place.

@Mihail: I was not able to exactly replicate what you were proposing. But 
assume you just read resources from the class path?

In the end the last thing is what I am doing. I moved away from storing my 
configuration in the servlet context and just treated my configuration file as 
a plain java resource (that is, I moved it to the src/main/resources folder 
instead of WEB-INF). Then, the solution is quite short:

public static void contributeSymbolSource(
                        final OrderedConfiguration<SymbolProvider> 
configuration) {
                configuration.add("DevSymbols", new 
ClasspathResourceSymbolProvider("configuration.properties"), 
"before:ApplicationDefaults");
}

Works like a charm for me.

Thank you again and best regards,

        Erik

Reply via email to