记录一下遇到的问题:

  1. 使用maven多模块搭建springcloud
    报错无法识别该依赖包
    原因是没有指定springcloud版本号
    可以在dependencyManagement中声明
<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.spring.platform</groupId>
                <artifactId>platform-bom</artifactId>
                <version>Brussels-SR11</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
  1. idea无法识别新建的springboot项目,配置文件颜色不对,启动类也报错
    原因之一:pom中没有引入spring-boot-starter的依赖
 <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-actuator</artifactId>
     </dependency>

这里可以用这个依赖代替spring-boot-starter,前者包含了后者

  1. 引入config配置中心的依赖包后,在启动类上加注解发现找不到@enableConfigServer
    这是由于config依赖包冲突了
    使用maven多模块搭建springcloud在这里可以进入本地的maven仓库该jar所在位置,将跟springcloud config有关的依赖文件夹全删了,让他重新加载maven就好了
  2. 新建的bootstrap.yml文件无法识别
    使用maven多模块搭建springcloud

这样即可

相关文章:

  • 2021-06-01
  • 2021-06-30
  • 2022-01-02
  • 2021-11-26
  • 2022-01-22
猜你喜欢
  • 2021-12-12
  • 2021-12-18
  • 2021-11-23
  • 2021-06-05
  • 2021-07-07
  • 2021-11-25
相关资源
相似解决方案