文档章节

springcloud gatway网关路由设置,POST请求,BODY体内容为空,服务抛404 NOT_FOUND

h
 huangkejie
发布于 2019/10/24 22:55
字数 1268
阅读 152
收藏 0

3 月,跳不动了?>>>

org.springframework.web.server.ResponseStatusException: 404 NOT_FOUND
        at org.springframework.web.reactive.resource.ResourceWebHandler.lambda$handle$0(ResourceWebHandler.java:325) ~[spring-webflux-5.1.5.RELEASE.jar:5.1.5.RELEASE]
        at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Mono.subscribe(Mono.java:3694) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:75) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onComplete(MonoFlatMap.java:174) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:96) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:360) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.java:212) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:139) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:63) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap.subscribe(FluxConcatMap.java:121) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoNext.subscribe(MonoNext.java:40) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.java:44) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Mono.subscribe(Mono.java:3694) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:172) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:67) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.java:275) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:849) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2070) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:162) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:1878) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:1752) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:90) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.java:59) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Mono.subscribe(Mono.java:3694) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:442) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerComplete(FluxConcatMap.java:289) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onComplete(FluxConcatMap.java:873) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:78) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:144) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Mono.subscribe(Mono.java:3694) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:75) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onComplete(MonoFlatMap.java:174) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:96) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:360) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerComplete(FluxConcatMap.java:289) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onComplete(FluxConcatMap.java:873) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:1742) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Operators$MonoSubscriber.onComplete(Operators.java:1545) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFilterWhen$MonoFilterWhenMain.innerResult(MonoFilterWhen.java:196) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFilterWhen$FilterWhenInner.onComplete(MonoFilterWhen.java:284) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxZip$ZipCoordinator.drain(FluxZip.java:684) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxZip$ZipInner.onComplete(FluxZip.java:915) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onComplete(MonoFlatMap.java:174) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onComplete(FluxContextStart.java:122) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onComplete(FluxMapFuseable.java:336) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onComplete(FluxFilterFuseable.java:385) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1508) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.MonoCollectList$MonoBufferAllSubscriber.onComplete(MonoCollectList.java:118) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136) [reactor-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
        at reactor.netty.channel.FluxReceive.terminateReceiver(FluxReceive.java:372) [reactor-netty-0.8.5.RELEASE.jar:0.8.5.RELEASE]
        at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:196) [reactor-netty-0.8.5.RELEASE.jar:0.8.5.RELEASE]
        at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:337) [reactor-netty-0.8.5.RELEASE.jar:0.8.5.RELEASE]
        at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:334) [reactor-netty-0.8.5.RELEASE.jar:0.8.5.RELEASE]
        at reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:453) [reactor-netty-0.8.5.RELEASE.jar:0.8.5.RELEASE]
        at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:141) [reactor-netty-0.8.5.RELEASE.jar:0.8.5.RELEASE]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:191) [reactor-netty-0.8.5.RELEASE.jar:0.8.5.RELEASE]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323) [netty-codec-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:297) [netty-codec-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930) [netty-transport-4.1.33.Final.jar:4.1.33.Final]
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:799) [netty-transport-native-epoll-4.1.33.Final-linux-x86_64.jar:4.1.33.Final]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:427) [netty-transport-native-epoll-4.1.33.Final-linux-x86_64.jar:4.1.33.Final]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:328) [netty-transport-native-epoll-4.1.33.Final-linux-x86_64.jar:4.1.33.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) [netty-common-4.1.33.Final.jar:4.1.33.Final]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_221]

主要的原因是红色加粗字体导致

 r.method(HttpMethod.POST).and().path(USER_ROUTE_PATHS).and().readBody(String.class, body->true)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://user"))

解决方案如下:

import com.mofu.gateway.filter.AppSignValidationGatewayFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.BooleanSpec;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.cors.reactive.CorsUtils;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;

@Configuration
public class RoutesConfig {

    @Autowired
    private AppSignValidationGatewayFilter appSignValidationGatewayFilter;

    private static final String[] USER_ROUTE_PATHS = new String[]{"/app/user/**", "/app/userAddress/**", "/app/idAuth/**",
            "/app/userAccount/**", "/app/withdraw/**", "/app/coupon/**", "/app/userCoupon/**", "/app/userCoin/**", "/app/recharge/**", "/app/mofuTree/**"};
    private static final String[] SYSTEM_ROUTE_PATHS = new String[]{"/app/sms/**","/app/system/**","/app/district/**",
            "/app/dict/**","/app/aliyun/**","/app/banner/**"};
    private static final String[] PAY_ROUTE_PATHS = new String[]{"/app/mpos/**","/app/bankcard/**","/app/quickPay/**","/app/pay/**","/app/chinapnr/**"};
    private static final String[] FINANCE_ROUTE_PATHS = new String[]{"/app/borrow/**","/app/finance/**","/app/investment/**"};

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route(r -> r.method(HttpMethod.POST).and().path(USER_ROUTE_PATHS).and().readBody(String.class, body->true)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://user"))
                // 解决POST请求,BODY内容体为空,抛404错误。。
                .route(r -> r.method(HttpMethod.POST).or().method(HttpMethod.GET).and().path(USER_ROUTE_PATHS).filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://user"))
                .route(r -> r.method(HttpMethod.POST).and().path(SYSTEM_ROUTE_PATHS).and().readBody(String.class, body->true)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://system"))
                .route(r -> r.method(HttpMethod.POST).or().method(HttpMethod.GET).and().path(SYSTEM_ROUTE_PATHS)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://system"))
                .route(r -> r.path("/alipay/**").uri("lb://system"))
                .route(r -> r.path("/callback/cardInfo/**").uri("lb://pay"))
                .route(r -> r.method(HttpMethod.POST).and().path(PAY_ROUTE_PATHS).and().readBody(String.class, body->true)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://pay"))
                .route(r -> r.method(HttpMethod.POST).or().method(HttpMethod.GET).and().path(PAY_ROUTE_PATHS)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://pay"))
                .route(r -> r.method(HttpMethod.POST).and().path(FINANCE_ROUTE_PATHS).and().readBody(String.class, body->true)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://finance"))
                .route(r -> r.method(HttpMethod.POST).or().method(HttpMethod.GET).and().path(FINANCE_ROUTE_PATHS)
                        .filters(f->f.filters(appSignValidationGatewayFilter))
                        .uri("lb://finance"))
                .build();
    }
}

 

 

© 著作权归作者所有

h
粉丝 5
博文 63
码字总数 24904
作品 0
广州
程序员
私信 提问
加载中

评论(0)

springcloud gatway Greenwich.SR2 body 无法接收

springcloud gatway Greenwich.SR2 版本 按照如下方法获取到了body 但是发现此时post请求必须 带上{} 否则无法路由

陈C维
03/06
42
0
SpringCloud和Dubbo ?

SpringCloud和Dubbo都是现在主流的微服务架构 SpringCloud是Apache旗下的Spring体系下的微服务解决方案 Dubbo是阿里系的分布式服务治理框架 从技术维度上,其实SpringCloud远远的超过Dubbo,D...

咔啡
02/26
470
1
史上最简单的 SpringCloud 教程 | 终章

版权声明:本文为博主原创文章,欢迎转载,转载请注明作者、原文超链接 ,博主地址:http://blog.csdn.net/forezp。 https://blog.csdn.net/forezp/article/details/70148833 转载请标明出处...

方志朋
2017/04/12
0
0
史上最简单的 SpringCloud 教程

《史上最简单的 SpringCloud 教程》系列: 史上最简单的 SpringCloud 教程 | 第一篇: 服务的注册与发现(Eureka) 史上最简单的SpringCloud教程 | 第二篇: 服务消费者(rest+ribbon) 史上最...

外星人et59
2018/04/21
0
0
Spring Cloud 入门教程7、服务网关(Zuul)

一、前言 1、什么是服务网关? 服务网关也就是API网关,服务网关可以作为服务的统一入口,提供身份校验、动态路由、负载均衡、安全管理、统计、监控、流量管理、灰度发布、压力测试等功能 服...

吴伟祥
2019/02/19
125
0

没有更多内容

加载失败,请刷新页面

加载更多

华为P40发布:搭载HMS硬刚谷歌,未涨价抢全球高端机市场

  文连线 Insight,作者向阳,编辑水笙   3 月 26 日晚,华为消费者业务 CEO 余承东登上台,以熟悉的英文口音开启了华为发布会,他说,“这就是我们的 P40 系列。”   以往华为P系列通...

水果黄瓜
8分钟前
14
0
如何从Java中的字符串值获取枚举值? - How to get an enum value from a string value in Java?

问题: Say I have an enum which is just 说我有一个枚举 public enum Blah { A, B, C, D} and I would like to find the enum value of a string, for example "A" which would be B......

javail
32分钟前
5
0
2048游戏的最佳算法是什么? - What is the optimal algorithm for the game 2048?

问题: I have recently stumbled upon the game 2048 . 我最近偶然发现了2048游戏。 You merge similar tiles by moving them in any of the four directions to make "bigger" tiles. 您可......

技术盛宴
今天
7
0
OSChina 周一乱弹 —— 小姐姐,这tm不是犬耳娘吗!你认错了吧

Osc乱弹歌单(2020)请戳(这里) 【今日歌曲】 @薛定谔的兄弟 :分享洛神有语创建的歌单「我喜欢的音乐」: 《Drip Drip Drip》- 音乐治疗 手机党少年们想听歌,请使劲儿戳(这里) @-Eric- ...

小小编辑
今天
34
0
HTML5 小游戏开发

HTML的基础 HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成...

冯六六
今天
17
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部