跳羚使用nacos的示例分析,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
1、pom.xml:
?xmlversion='1.0 '编码='UTF-8 '?
项目xmlns=' http://aven。阿帕奇。org/POM/4。0 .0 ' xmlns : xsi=' http://www。w3。org/2001/XMLSchema-instance '
xsi :架构位置=' http://aven。阿帕奇。org/POM/4。0 .0https://aven。阿帕奇。org/xsd/maven-4。0 .0 .xsd '
模型版本4 .0 .0/模型版本
父母
groupIdorg.springframework.boot/groupId
artifactIdspring-boot-starter-parent/artifactId
版本2 .4 .2/版本
relativePath/
/家长
groupIdcom.shif/groupId
artifactIdspring-jwt/artifactId
版本0 .0 .1-快照/版本
namespring-jwt/name
描述pringboot/的演示项目描述
性能
java.version1.8/java.version
nacos-配置-弹簧-启动。版本0。2 .1/nacos-config-spring-boot。版本
/properties
属国
!-解决启动参数“服务名”是合法的,serviceName是空的问题-
属国
groupIdorg.springframework.cloud/groupId
artifactIdspring-cloud-starter-bootstrap/artifactId
n
bsp; <version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.59</version>
</dependency>
<!-- nacos discovery and config 版本选择参考nacos官网推荐-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2021.1</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2021.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
版本选择参考nacos官网推荐
2、application.yml和bootstrap.yml:
spring: profiles: active: dev redis: host: ${REDIS_HOST:20.20.30.125} port: ${REDIS_PORT:6379} password: ${REDIS_PASSWORD:abc@123}
server: address: x.x.x.x port: 9091 spring: application: name: jwttest cloud: nacos: discovery: server-addr: x.x.x.x:8848 config: server-addr: x.x.x.x:8848 group: dev file-extension: yaml
看完上述内容,你们掌握springboot使用nacos的示例分析的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/153809.html