SpringBoot启动报: expected single matching bean but found 2

Exception screenshot:
Insert picture description here

It can be roughly seen from the exception information: We originally wanted him to find GmsChannelService, but when it started, we found two, one is GmsChannelService and the other is GmsChannelServiceImpl:

Let's look at the controller layer again:
we use the @Autowired annotation here, and want to get the service through automatic boxing
Insert picture description here

Let's look at the serviceImpl layer again:
Insert picture description here
Solution:
Controller layer: add @Qualifier
Insert picture description here
serviceImp layer
@Service -->@Service(GmsChannelService)
Insert picture description here
Is the soup fragrant? ?
Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42258975/article/details/109672830