I've a Configuration.java singleton class (with many properties loaded by a file) that I would like to inject in some classes in my Application.
So, I bind my injection in the ResourceConfig class with an AbstractBinder.
Now, I need to use this Configuration class in this ResourceConfig.
For example, in my Configuration class there is a property named "packages", that I have to use in ResourceConfig class in order to register package.
The issue is that the injection is not starting in the ResourceConfig class.
class Configuration {
//many properties
String packages = "";
}
class MyResourceConfig extends ResourceConfig {
@Inject
Configuration configuration;
MyResourceConfig() {
...
register(MyBinder.class); //with many injection
...
packages(configuration.packages);
}
}
So could you please advice me how to have this lifecycle ? (maybe I have to use another jersey class ?)