spring boot整合nacos报错:Consider defining a bean of type ‘com.netflix.client.config.IClientConfig‘ in y

编程知识 更新时间:2023-05-02 05:27:10

spring boot整合nacos报错:

Consider defining a bean of type 'comflix.client.config.IClientConfig' in your configuration.

问题原因代码:

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = {"com.*"})
@MapperScan("com/mapper/")
public class ShoppingServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(ShoppingServiceApplication.class, args);
    }

}

修改为:

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = {"com.shopping.*"})
@MapperScan("com/shopping/mapper/")
public class ShoppingServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(ShoppingServiceApplication.class, args);
    }

}

主要把:

@ComponentScan(basePackages = {"com.*"})

改为:

@ComponentScan(basePackages = {"com.shopping.*"})

如果没有整合mabatis可以把 @MapperScan("com/shopping/mapper/")  去掉。

把扫描的路径改成大于2层。

更多推荐

spring boot整合nacos报错:Consider defining a bean of type ‘com.netflix.client.config

本文发布于:2023-04-26 06:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/07b9d868e7a564a17f74d61c962586df.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报错   defining   nacos   spring   boot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 104437文章数
  • 26214阅读数
  • 0评论数