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

给别人做ppt的网站福州百度seo

给别人做ppt的网站,福州百度seo,seo专业培训网络班,网站建设销售之前你如果要用spring cloud gateway ,就必须是webflux 的,也就是必须是异步响应式编程。不能和spring mvc 一起使用。现在spring cloud 新出了一个可以不用webflux的gateway。 具体使用mvc的gateway步骤如下 普通的Eureka Client的项目 如果你只是想测…

之前你如果要用spring cloud gateway ,就必须是webflux 的,也就是必须是异步响应式编程。不能和spring mvc 一起使用。现在spring cloud 新出了一个可以不用webflux的gateway。

具体使用mvc的gateway步骤如下

普通的Eureka Client的项目

如果你只是想测试一下gateway mvc,可以建一个普通的spring boot项目,然后写一个/test rest api就可以了。

application.yml

spring:application:name: eureka-clientcloud:compatibility-verifier:enabled: false
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/instance:hostname: localhost
server:servlet:context-path: /eureka-clientport: 8080

TestController.java

@RestController
public class TestController {@RequestMapping(value = "/test", method = RequestMethod.GET)public String test() {return "test";}
}

EurekaClientApplication.java

@SpringBootApplication
@EnableDiscoveryClient
public class EurekaClientApplication {public static void main(String[] args) {SpringApplication.run(EurekaClientApplication.class, args);}
}

访问http://localhost:8080/eureka-client/test

Gateway MVC 的项目

在pom.xml加spring-cloud-starter-gateway-mvc 

    <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.2.4</version><relativePath/> <!-- lookup parent from repository --></parent><properties><java.version>17</java.version><spring-cloud.version>2023.0.0</spring-cloud.version></properties><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway-mvc</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></dependencies></dependencyManagement>

application.yml

spring:application:name: gateway-mvc
server:port: 8088

RouteConfiguration.java

package com.example.gateway;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.function.RouterFunction;
import org.springframework.web.servlet.function.ServerResponse;import static org.springframework.cloud.gateway.server.mvc.handler.GatewayRouterFunctions.route;
import static org.springframework.cloud.gateway.server.mvc.handler.HandlerFunctions.http;@Configuration
public class RouteConfiguration {@Beanpublic RouterFunction<ServerResponse> getRoute() {return route("simple_route").GET("/eureka-client/**", http("http://localhost:8080")).build();}
}

或者用配置文件的方式.application.yml

spring:cloud:gateway:mvc:routes:- id: simple_routeuri: http://localhost:8080predicates:- Path=/eureka-client/**

GatewayApplication.java

@SpringBootApplication
public class GatewayApplication {public static void main(String[] args) {SpringApplication.run(GatewayApplication.class, args);}}

访问http://localhost:8080/eureka-client/test

如果你不想hardcode 你的hostname和端口,也可以用Eureka 的方式来获取hostname和端口号

    @Beanpublic RouterFunction<ServerResponse> gatewayRouterFunctionsAddReqHeader() {return route("api_route").GET("/eureka-client/**", http()).filter(lb("EUREKA-CLIENT")).build();}

Spring Cloud Gateway Server MVC :: Spring Cloud Gateway

http://www.15wanjia.com/news/21205.html

相关文章:

  • 哪些域名适合营销型网站一站式网站建设公司
  • 阜沙网站建设百度服务中心人工客服电话
  • b2c网站建设费用seo技术网网
  • 莆田网站建设网站域名解析ip查询
  • 福田建网站公司seo服务包括哪些
  • 网站产品展示怎么做搜索引擎营销是指
  • flash网站源码 免费营销推广渠道有哪些
  • 做网站的必要性北京百度快速优化排名
  • 免费中文wordpress主题下载地址网络优化工程师有多累
  • 页面设计培训学什么云南网络营销seo
  • 制作网站软件用什么语言百度竞价排名的利与弊
  • 网站建设的关键技术免费b站推广网站下载
  • wordpress 索引百度推广优化排名怎么收费
  • 有哪些做特卖的网站引擎优化seo怎么做
  • 帮别人做app网站门户的兼职广告软文怎么写
  • 外贸网站模板哪里下载电子报刊的传播媒体是什么
  • 做商城网站需要备案什么域名网络营销的特点
  • 装修网站怎么做兰州网络seo
  • 购买域名如何建设网站在线搭建网站
  • wordpress友情链接做导航谷歌搜索引擎seo
  • 诏安网站建设怎样做网站推广啊
  • 做元器件上什么网站想在百度上推广怎么做
  • 又一个 wordpress 站点运营推广是做什么的
  • 网站建设方案书的内容seo网络推广是什么意思
  • wordpress编辑器添加代码工具seo 工具分析
  • 网站运营经验分享ppt模板产品推广介绍怎么写
  • 做网站的可以黑客户的网站吗seo广告优化
  • iis服务器怎么部署php网站广告的六种广告形式
  • 网站培训费用百度手机快速排名点击软件
  • 网站建设 中企动力厨具全国疫情高峰感染高峰进度