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

上一篇:Consider defining a bean of type 'javax.persistence.EntityManagerFactory' in your configur


下一篇:Android--应用开发2(AndroidManfest.xml)