package com.test.controller.com;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.function.RouterFunction;
import org.springframework.web.servlet.function.RouterFunctions;
import org.springframework.web.servlet.function.ServerResponse;
@RestController
public class FunController {
/**
* 传统式接口
* @return
*/
@RequestMapping("/customer")
public String cunstomer(){
return "customer";
}
/**
* 函数式接口
* @return
*/
@Bean
public RouterFunction fooFunction(){
return RouterFunctions.route().GET("/fun", request->ServerResponse.ok().body("hello fun")).build();
}
}
详细参考地址:https://my.oschina.net/10000000000/blog/4279377
函数式Spring MVC接口
最新推荐文章于 2023-07-30 17:55:16 发布