我需要了解如何将对象绑定并注入到普通类中,如下所示:
Exampl1: Want to inject B Obj to the class, here i dont have any constructor.
class A {
@Inject private B obj;
}
Example2: Want to inject B Obj to class and i have a constructor also.
Class X {
private B obj;
@Inject public X(int arg1, B obj) {
this.obj = obj;
}
class Module extends AbstarctModule {
void Configure() {
//How to use bind
}
有人可以帮我吗?