@Autowired注解出错的原因

1、EtcSourceServiceImpl实现类必须用@Service或@Component在类上面注解。

@Service
public class EtcSourceServiceImpl implements EtcSourceService{}

2、注入的时候吧接口写成实现类了

 @Autowired
 private EtcSourceServiceImpl sourceServiceImpl ;
 应该是:
 private EtcSourceService sourceService;

3、在EtcSourceDomain 类上加上@Repository注解

4、代码里有地方用到了dubbo的Service 引入的时候没注意 自动引成了

com.alibaba.dubbo.config.annotation.Service;
应该引的是
org.springframework.stereotype.Service

你可能感兴趣的:(Spring)