🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] # `@Bean` ~~~ @Bean public String hello(){ return "Hello World"; } ~~~ @Bean:就是在spring容器中声明了一个bean,赋值为hello world,String方法类型就是bean的类型,hello方法名是bean的id 如果是用xml配置文件来声明bean,如下图 ~~~ <bean id="hello" class="String"></bean> ~~~ # `@RequestBody` ~~~ //直接指定Post请求,同样也有@GetMapping   @PostMapping("/url")   //@RequestBody是指请求来的参数是json格式,以json格式来转换到uer,现在用json传参已经用的越来越多   public String hello(@RequestBody User user){       return "hello world";   }   ~~~