admin管理员组

文章数量:1794759

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

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

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层。

本文标签: 报错definingNacosspringboot