admin管理员组

文章数量:1530842

Spring

1、已经使用@Service注解定义了UserService的实现类,但是Spring没有扫描到。

解决方法:

(1)将当前模块的Dao类、Service类、Entity类、Controller类放在和XxxApplication启动类同一目录下或者子目录下。

(2)在xxxApplication启动类加上 @ComponentScan(“com”) 注解。

2、UserService启动装配时变量名默认为实现类的名字userServiceImpl,实现类是UserServiceImpl类,而我们使用@Autowired注解时变量名为userService。

解决办法:

将实现类的@Service改为@Service(“userService”)。

OpenFeign

1、使用了OpenFeign来调用其他微服务的接口,但是OpenFeign相关的jar包没有完成导入。

2、使用OpenFeign来调用其他微服务的接口时,XxxApplication启动类未加@EnableFeignClinets注解。

本文标签: 错误情况beantypedefining