Code example for field injection and other changes

This commit is contained in:
Vasudha Venkatesan
2020-03-10 10:55:35 +05:30
committed by akuksin
parent 670c4c845a
commit 4b959cb797
14 changed files with 205 additions and 43 deletions

View File

@@ -0,0 +1,27 @@
package com.example.fieldinjection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.example.dependency.Topping;
@Component
public class IceCream {
@Autowired
Topping toppings;
public Topping getToppings() {
return toppings;
}
void setToppings(Topping toppings) {
this.toppings = toppings;
}
@Override
public String toString() {
return "IceCream [toppings=" + toppings + "]";
}
}