Spring的@Autowire 简单使用
首先准备好类Friend / Hello/ SpringConfiger
package com.lin.HowMuch.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/*
@Component
@Scope("singleton")*/
public class Friend {
@Override
public String toString() {
return super.toString();
}
}
package com.lin.HowMuch.Bean;
import org.springframework.beans.factory.annotation.Autowired;
import org.