当前位置: 首页 > news >正文

与建设有关的政府网站seo营销技巧

与建设有关的政府网站,seo营销技巧,链家做网站和手机app花了多少钱,什么网站可以做简历根据公司要求,需要将项目集成到nacos中,当前项目是基于若依前后端分离版开发的,若依的版本为3.8.3,若依框架中整合的springBoot版本为2.5.14。Nacos核心提供两个功能:服务注册与发现,动态配置管理。 一、服…

        根据公司要求,需要将项目集成到nacos中,当前项目是基于若依前后端分离版开发的,若依的版本为3.8.3,若依框架中整合的springBoot版本为2.5.14。Nacos核心提供两个功能:服务注册与发现,动态配置管理。


一、服务注册与发现

1、引入pom依赖

     </dependency>--><!-- 在SpringBoot 2.4.x的版本之后,对配置文件加载方式进行了重构,需要导入如下的依赖;详情见官网:https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#config-first-bootstrap --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bootstrap</artifactId><version>3.0.1</version></dependency><!-- 服务注册与发现依赖 --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId><version>2021.1</version></dependency>

2、bootstrap.yml配置

spring:# nacos配置cloud:nacos:discovery:server-addr: 10.2.XX.XX:8848compatibility-verifier:enabled: false

3、添加注解

在项目启动类上添加 @EnableDiscoveryClient 注解:

@EnableDiscoveryClient
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RiskExamineApplication
{public static void main(String[] args){// System.setProperty("spring.devtools.restart.enabled", "false");SpringApplication.run(RiskExamineApplication.class, args);System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +" .-------.       ____     __        \n" +" |  _ _   \\      \\   \\   /  /    \n" +" | ( ' )  |       \\  _. /  '       \n" +" |(_ o _) /        _( )_ .'         \n" +" | (_,_).' __  ___(_ o _)'          \n" +" |  |\\ \\  |  ||   |(_,_)'         \n" +" |  | \\ `'   /|   `-'  /           \n" +" |  |  \\    /  \\      /           \n" +" ''-'   `'-'    `-..-'              ");}
}

4、验证

        项目启动后,登录nacos,在服务列表中,点击查询即可看到注册到nacos的服务,如下图:

服务名默认为yml配置里spring.application.name的名称,也可通过spring.cloud.nacos.discovery.service配置指定。

遇到问题:Your project setup is incompatible with our requirements due to following reasons:
- Spring Boot [2.5.14] is not compatible with this Spring Cloud release train

Change Spring Boot version to one of the following versions [2.3.x, 2.4.x] 


***************************
APPLICATION FAILED TO START
***************************Description:Your project setup is incompatible with our requirements due to following reasons:- Spring Boot [2.5.14] is not compatible with this Spring Cloud release trainAction:Consider applying the following actions:- Change Spring Boot version to one of the following versions [2.3.x, 2.4.x] .
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn]. 
If you want to learn more about the Spring Cloud Release train compatibility, you can visit this page [https://spring.io/projects/spring-cloud#overview] and check the [Release Trains] section.
If you want to disable this check, just set the property [spring.cloud.compatibility-verifier.enabled=false]

解决办法:出现这个问题是由于springBoot和springCloud版本不一致导致的,如果是自己手动搭建的框架,可以根据提示将springBoot版本降到[2.3.x, 2.4.x];但是由于我用的是若依的框架,担心将springBoot版本降低后会引起其它问题,所以根据提示设置spring.cloud.compatibility-verifier.enabled=false这个属性,但是引入后发现配置不生效,最后根据研究一番之后,根据网上的提示需将配置文件名称application.yml改为bootstrap.yml,然后再引入依赖spring-cloud-starter-bootstrap 即可解决。

注意:如果只需要nacos的服务注册与发现功能,不用服务配置功能的话,一定要将服务配置的pom依赖(spring-cloud-starter-alibaba-nacos-config)去掉,否则启动时会报错:currentServerAddr:http://localhost:8848, err : connect timed out 。

二、服务动态配置与服务注册发现

1、引入pom依赖

  <!-- nacos --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId><version>2021.1</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bootstrap</artifactId><version>3.0.1</version></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId><version>2021.1</version></dependency>

2、bootstrap.yml配置

spring:cloud:nacos:discovery:server-addr: 124.70.XX.XX:32389namespace: zs-smartgroup: devconfig:server-addr: 124.70.XX.XX:32389namespace: zs-smartgroup: devname: zs-smartfile-extension: yamlcompatibility-verifier:enabled: false

3、nacos配置

1)新建命名空间

 2) 新建配置

打开配置列表,选择刚刚创建的zs-smart,点击右上角的“+”号,如下图:

3)填写配置

然后启动项目,如果项目启动成功,即说明配置没问题! 

参考文章:Springboot集成Nacos2「服务注册与发现」 - 知乎

http://www.tj-hxxt.cn/news/115919.html

相关文章:

  • 做自己个人网站抖音关键词搜索指数
  • 小型企业网站模板下载百度搜索官方网站
  • 怎么免费搭建网站企业整站推广
  • 门业网站 模板百家号自媒体平台注册
  • 广东圆心科技网站开发企业网络营销方案策划
  • 网站生成手机端灰色词快速上排名
  • 北京企业网站建设费用seo有哪些经典的案例
  • 福建省人民政府关于印发福建省定价目录的通知网页优化最为重要的内容是
  • 酒类做网站企业管理培训视频免费
  • 免费网站正能量百度极速版下载
  • php简易企业网站源码重庆seo网络推广关键词
  • app产品网站模板免费建自己的网站
  • 电商网站建设存在的问题和处理方案小说推文万能关键词
  • 网站建设的内容要怎么写卖网站链接
  • 万网免费网站怎样做市场营销策划
  • 电商网站开发建设2020年十大关键词
  • wordpress 同分类文章北京搜索引擎优化管理专员
  • 网站建设的流程百度收录网站需要多久
  • 不会代码可以做网站吗万网域名注册查询网
  • 绍兴以往网站招工做商家联盟营销方案
  • 济南轻电商网站建设公司交易平台
  • wordpress后台分类添加图片湘潭seo快速排名
  • 乐之网站制作最近的国际新闻大事
  • 做微博网站好不好爱站seo综合查询
  • 邯郸哪里可以学建网站宁波网络推广联系方式
  • 做竞价的网站做优化有效果吗企业管理培训课程
  • 计算机上网题的模拟网站怎么做郑州网站托管
  • 做学术研究的网站关键词搜索工具app
  • 食品网站应该怎么做百度seo关键词优化方案
  • 网站建设印花税百度地址