在此記錄最少依賴使用nacos作為配置中配置信息情況拿霉,本文是在上一篇文章(http://www.reibang.com/p/9caba971cf3b)的基礎(chǔ)上做的簡化
Spring Boot parent配置依賴不變裕照,配置文件bootstrap.yml和bootstrap-dev.yml文件內(nèi)容也不變掂之,移除掉Spring Cloud配置佑稠。
最終pom依賴信息如下
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>spring-cloud-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-cloud-demo</name>
<description>Demo project for Spring Boot</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
說明:其實(shí)之所以可以移除掉Spring Cloud的依賴是因?yàn)閟pring-cloud-starter-alibaba-nacos-config已經(jīng)有對于Spring Cloud的基本依賴了。但是如果需要使用Spring Cloud的其他一些插件咸这,還是需要另外在引入Spring Cloud的依賴贮勃。
如果錯誤,請大家?guī)兔χ赋觥?/p>