Code example for field injection and other changes
This commit is contained in:
committed by
akuksin
parent
670c4c845a
commit
4b959cb797
@@ -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 + "]";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user