
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层。
👁️ 阅读量:0
© 版权声明:本文《spring boot整合nacos报错:Consider defining a bean of type ‘com.netflix.client.config.IClientConfig‘ in y》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686554440a290521.html。