I newbie in java i don't know of all possibilites. I want to know can i implement something like this:
class DIConfig {
// create at start of application (integration with javaee container)
// load configurable files and stores all configuration
}
class Foo {
// use DIConfig to inject value stored in DIConfig to String url
@Config("general.url")
String url;
public void bar() {
// same thing with local variable
@Config("export.maxRows")
int maxRows;
}
}
It's available? How can i do it? My trouble - i don't understand how to using annotation execute some code and stores result in annotaed variable.
Seems it not possible. All DI frameworks use something like binder - i've many classes that using configuration property and create all of this classes via binder or something like this - impossible. I search mechanism that don't use any binders. Somethinh like interceptors (AOP) but initialize variable instead wrap method invoke.