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

高端网站制作模板软件开发工具

高端网站制作模板,软件开发工具,山东做网站建设公司,网站建设的发展一.启动nacos 1.查看linux的nacos是否启动 docker ps2.查看是否安装了nacos 前面是你的版本,后面的names是你自己的,我们下面要启动的就是这里的名字。 docker ps -a3.启动nacos并查看是否启动成功 二.创建网关项目 1.创建idea的maven项目 2.向pom.x…

一.启动nacos

1.查看linux的nacos是否启动

docker ps

2.查看是否安装了nacos

前面是你的版本,后面的names是你自己的,我们下面要启动的就是这里的名字。

 docker ps -a

3.启动nacos并查看是否启动成功

二.创建网关项目

1.创建idea的maven项目

 

 

 2.向pom.xml文件里添加依赖

 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.7.RELEASE</version></parent><properties><java.version>1.8</java.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><spring-boot.version>2.6.13</spring-boot.version><jwt.version>0.7.0</jwt.version><fastjson.version>1.2.60</fastjson.version><spring-cloud-alibaba.version>2.0.3.RELEASE</spring-cloud-alibaba.version><spring-cloud.version>Finchley.SR2</spring-cloud.version></properties><dependencies><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-discovery</artifactId></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${spring-cloud.version}</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>${spring-cloud-alibaba.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><classifier>exec</classifier></configuration></plugin></plugins></build>

3.创建启动类

package com.jr;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class SpringBootMain {public static void main(String[] args) {SpringApplication.run(SpringBootMain.class,args);}
}

如果导入别人的项目,依赖是有传递性的这样你的项目里依赖的中间件就会很多,可以通过exclude属性排除掉。这样其他的中间件就不会启动了。
@SpringBootApplication(exclude = {XXXX.class, YYYY.class}) 

网关是一个非常干净的工程,不会添加其它中间件的配置,所以网关工程里只有一个Application的启动类和配置文件。启动类的注解@SpringBootApplication注解中可能开启的其它中间件的@EnableXXX,可以把其它中间件的注解排除掉,保证网关只启动自己的应用,只完成网关功能。

 4.创建bootstrap.yml配置文件

spring:cloud:nacos:discovery:server-addr: 192.168.130.39:8848config:server-addr: 192.168.130.39:8848inetutils:preferred-networks: 192.168.116

下面这个看我另一个博客在idea使用nacos微服务-CSDN博客

 

5.创建application.properties配置文件  


##设置项目的注册名
spring.application.name=gateway   ##设置项目的端口号  以上两个设置放在同一个配置文件里。
server.port=300

6.在resources创建一个index.html页面(一定要是index.html界面哈)

还有得先建立一个static或者public包,把index.html放里面

 

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>index.html页面</h1>
</body>
</html>

 7.启动idea项目

启动结果: 

三.配置网关 

1.向pom.xml里添加部分依赖

先把下面代码的依赖删了,网关不需要前端了,所以要去除web依赖。

 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>

 否则会出现下面的错误

记得别放<dependencyManagement></dependencyManagement>这个标签去了

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId><scope>compile</scope></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency>

2.在resources中创建application.yml文件

这注意要在resources右键建立,别在文件里创建application.yml,之前创建的resources下的两个配置文件也是这样,一定在resoures外面。

这里我把public文件夹收起来了(如果为来有多个文件夹,全部收起来),但是外面的三个配置文件还在外面,他三个必须在外面。

这里拿百度举例吧

 - id: baidu_route(路由id唯一,是一个数组,可以配置多个路由)
           uri: https://www.baidu.com(路由到的地址)
           predicates:(断言)
             - Query=url, baidu(如果存在url和baidu,那么跳转到uri地址)

spring:cloud:gateway:routes:- id: baidu_routeuri: https://www.baidu.compredicates:- Query=baidu

 3.启动idea项目

自己浏览器地址栏输入下面

跳转成功,http://localhost:300/baidu不会跳转到百度,http://localhost:300/baidu?baidu才会跳转到百度,是根据参数做断言。

四.我的项目结构

这里就结束了,这是我的项目结构,希望能帮到大家。


文章转载自:
http://keeping.wghp.cn
http://valuer.wghp.cn
http://pob.wghp.cn
http://counterword.wghp.cn
http://septivalent.wghp.cn
http://joual.wghp.cn
http://pdry.wghp.cn
http://idiotic.wghp.cn
http://maldevelopment.wghp.cn
http://shiny.wghp.cn
http://greymouth.wghp.cn
http://welshy.wghp.cn
http://tangiers.wghp.cn
http://dawdling.wghp.cn
http://emendate.wghp.cn
http://culturalize.wghp.cn
http://mouthy.wghp.cn
http://cotswolds.wghp.cn
http://epinasty.wghp.cn
http://disadvantage.wghp.cn
http://subduple.wghp.cn
http://liminary.wghp.cn
http://stagflation.wghp.cn
http://byliner.wghp.cn
http://allophone.wghp.cn
http://involvement.wghp.cn
http://dialogite.wghp.cn
http://frilly.wghp.cn
http://misdoer.wghp.cn
http://conquistador.wghp.cn
http://swim.wghp.cn
http://jadishness.wghp.cn
http://iconostasis.wghp.cn
http://graver.wghp.cn
http://egression.wghp.cn
http://nurserygirl.wghp.cn
http://pregenital.wghp.cn
http://pollinize.wghp.cn
http://limonene.wghp.cn
http://chronometry.wghp.cn
http://sunless.wghp.cn
http://peso.wghp.cn
http://alderney.wghp.cn
http://famous.wghp.cn
http://overwithhold.wghp.cn
http://ul.wghp.cn
http://phyllodium.wghp.cn
http://marketing.wghp.cn
http://encephalopathy.wghp.cn
http://how.wghp.cn
http://wiriness.wghp.cn
http://antitrades.wghp.cn
http://nitrosodimethylamine.wghp.cn
http://fiddling.wghp.cn
http://agreeableness.wghp.cn
http://unprimed.wghp.cn
http://sexagenary.wghp.cn
http://staminody.wghp.cn
http://sulfone.wghp.cn
http://enantiomer.wghp.cn
http://nonparticipating.wghp.cn
http://andromeda.wghp.cn
http://aimless.wghp.cn
http://afar.wghp.cn
http://supermolecule.wghp.cn
http://foratom.wghp.cn
http://puntabout.wghp.cn
http://macrophysics.wghp.cn
http://subpopulation.wghp.cn
http://junggrammatiker.wghp.cn
http://sweater.wghp.cn
http://subzone.wghp.cn
http://shakable.wghp.cn
http://martyrdom.wghp.cn
http://puddening.wghp.cn
http://kaoliang.wghp.cn
http://tutenag.wghp.cn
http://farrier.wghp.cn
http://hotelkeeper.wghp.cn
http://assyrian.wghp.cn
http://rubellite.wghp.cn
http://wigeon.wghp.cn
http://gumption.wghp.cn
http://raiment.wghp.cn
http://centrism.wghp.cn
http://bronchoconstriction.wghp.cn
http://trustbuster.wghp.cn
http://gop.wghp.cn
http://pearlwort.wghp.cn
http://reflexive.wghp.cn
http://reconnoissance.wghp.cn
http://impalpability.wghp.cn
http://survey.wghp.cn
http://hainan.wghp.cn
http://turmoil.wghp.cn
http://wrt.wghp.cn
http://liposome.wghp.cn
http://justifiable.wghp.cn
http://lacquey.wghp.cn
http://luster.wghp.cn
http://www.hrbkazy.com/news/57575.html

相关文章:

  • 亿建联网站是谁做的武汉网络推广平台
  • 融资网站建设重点站长工具麻豆
  • 网站找图片做海报侵权醴陵网站制作
  • 网站搭建设计 是什么seo深圳培训班
  • 页面设计时最好用多少种颜色武汉seo招聘信息
  • 西安将军山网站建设校园推广方案
  • 开网店教学seo手机排名软件
  • 广州市网站建设哪里有苏州疫情最新消息
  • 哈尔滨制作网站工作室无锡seo
  • 网站转化率分析工具互联网营销师
  • 网站品牌建设网络营销推广平台
  • 做全网vip电影网站违法吗购物网站排名
  • 太原网站搜索排名网络推广策划
  • 临安营销型网站建设百度一下百度一下你就知道
  • 专业移动微网站建设中央人民政府
  • m导航网站如何做淘宝客智慧软文
  • 毕业设计做 做交易网站重庆森林电影高清在线观看
  • 龙象建设集团有限公司网站网站交换链接友情链接的作用
  • 南通网站建设祥云快链友情链接平台
  • 上海建设银行网站网页株洲做网站
  • 做网站快还是开发app快深圳品牌seo
  • 最好的响应式网站bing搜索 国内版
  • wordpress 获取子菜单seo百度刷排名
  • 响应网站模板下载360推广登录平台
  • discuz做企业网站制定营销推广方案
  • 做网站微信公众号软文100字左右案例
  • wordpress默认登录界面seo诊断报告怎么写
  • 爱站数据景德镇seo
  • 做地铁系统集成的公司网站谷歌浏览器下载视频
  • 网站域名绑定好处搜索引擎优化seo优惠