admin管理员组

文章数量:1596345

Consider defining a bean of type ‘XXX’ in your configuration


出现这个错误,要看看你是否用到了某些组件,但是启动类上没加相应的注解。比如说我就是因为在service层用到了@FeignClient注解,但是在启动类上忘了加上@EnableFeignClients注解,才导致的报错,写代码一定要细心啊。



异常信息如下:

Description:

A component required a bean of type 'com.atgugu.springcloud.service.PaymentHystrixService' that could not be found.


Action:

Consider defining a bean of type 'com.atgugu.springcloud.service.PaymentHystrixService' in your configuration.


service层代码如下:

package com.atgugu.springcloud.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
@FeignCl

本文标签: 报错definingSpringBootbeanconfiguration