Lets take two classes parent class and children class.
Parent class want's children object within itself.
Class Children {
public helloChildren (){
System.out.orintln ("hello children");
}
}
Class Parent {
private Children children;
@autowired
public Parent (Children children){
this.children=children;
}
public void helloParent (){
System.out.println ("hello parent");
children.helloChildren ();
}
}
Its done threw annotation.
Parent class want's children object within itself.
Class Children {
public helloChildren (){
System.out.orintln ("hello children");
}
}
Class Parent {
private Children children;
@autowired
public Parent (Children children){
this.children=children;
}
public void helloParent (){
System.out.println ("hello parent");
children.helloChildren ();
}
}
Its done threw annotation.