WebFlux系列(一)HelloWorld

java#spring#webflux#入门#编程

Spring WebFlux web的基本应用

视频讲解: https://www.bilibili.com/vide...

WebfluxApplication.java

package com.example.webflux;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

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

    @RestController
    class EmployeeController{
        @GetMapping(value = "greeting",produces = MediaType.TEXT_EVENT_STREAM_VALUE)
        public Flux greeting() {
            return Flux.just("Hello World");
        }
    }
}

公众号,坚持每天3分钟视频学习

你可能感兴趣的:(spring,java,reactor,springboot,入门)