在spring配置文件配置了自动扫描<context:component-scan />的前提下:
一:不要new xxxService;
二:检查类上是否加了@Component注释,没有的要加上;
三:在调用该普通类的Controller层有没有@Autowired该类,没有的加上
在spring配置文件配置了自动扫描<context:component-scan />的前提下:
一:不要new xxxService;
二:检查类上是否加了@Component注释,没有的要加上;
三:在调用该普通类的Controller层有没有@Autowired该类,没有的加上