@Autowired与@Component(包括衍生类@Controller @Service @Repository )
使用细节
@Autowired的定的对象名要与@Component 中的value值一致
或者使用@Qualifier注解
public class AccountServiceTest {
@Autowired
private AccountService myAccountService;
}
@Service("myAccountService")
public class AccountServiceImpl implements AccountService {
@Autowired
private AccountDao accountDao;
}