<util:constant static-field="MyClass.MyStaticVar"/>
Posts mit dem Label java werden angezeigt. Alle Posts anzeigen
Posts mit dem Label java werden angezeigt. Alle Posts anzeigen
Dienstag, 30. Juni 2009
Hint: Injecting static variable into Spring Beans
Several times I was wondering if it is possible to inject the value of a static variable into spring beans, now I stumbled over the solution:
Dienstag, 25. November 2008
Spring: Get Classpath Resources with Wildcards
With Spring's Resource abstraction it is easy to load resources from the classpath, but what if you need to load many files that follow a certain naming pattern? The following code accomplishes that with the org.springframework.core.io.support.PathMatchingResourcePatternResolver, it supports the same wildcards in the URL like the ApplicationContextLoader:
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
Resource[] resources = patternResolver.getResources("classpath:/conf/aggregations/*_agg.xml");
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
Resource[] resources = patternResolver.getResources("classpath:/conf/aggregations/*_agg.xml");
Abonnieren
Posts (Atom)