私はこのような@Autowired
注釈を使用します。@Autowired注釈は正しく使用されていますか?
@Autowired
private MyService1 myService1;
@Autowired
private MyService2 myService2;
しかし、新しいのIntelliJ IDE 2016(3)提案して交換することを提案している:
private final MyService1 myService1;
private final MyService2 myService2;;
@Autowired
public MyClass(MyService1 myService1, MyService2 myService2) {
this.myService1= myService1;
this.myService2= myService2;
}
は違い、何の権利であるが、何を教えてくださいましたか?
[Setter DIとコンストラクタDIの春の可能な複製?](http://stackoverflow.com/questions/7779509/setter-di-vs-constructor-di-in-spring) – Jesper