zoukankan      html  css  js  c++  java
  • 基础学习前后端link

    package com.example.restservice;
    
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.PostMapping;
    import org.springframework.web.bind.annotation.RequestParam;
    import org.springframework.web.bind.annotation.RestController;
    
    import java.util.concurrent.atomic.AtomicLong;
    
    @RestController
    

    //Spring’s approach to building RESTful web services, HTTP requests are handled by a controller. These components are identified by the @RestController annotation, and the GreetingController
    //This code uses Spring @RestController annotation, which marks the class as a controller where every method returns a domain object instead of a view. It is shorthand for including both @Controller and @ResponseBody.

    public class GreetingController {
            
        private static  final;
        String template = "Hello,%s!";
    
        private  final AtomicLong counter = new AtomicLong(); 
    
        @GetMapping("/greeting")  //get方法 GET requests for /greeting,
        The @GetMapping annotation ensures that HTTP GET requests to /greeting are mapped to the greeting() method.
        @GetMapping注释确保对greeting()方法的HTTP GET请求被映射到greeting()方法。
    
    
         其他HTTP动词也有相应的注释(例如@PostMapping用于POST)。还有一个@RequestMapping注释,它们都是从这个注释派生出来的,可以作为同义词(例如@RequestMapping(method=GET))。
    
    
        public  Greeting greeting(@RequestParam(value = "name",defaultValue ="ShenXiaoDao") String name){   
            return new Greeting(counter.incrementAndGet(),String.format(template,name));
        }
    }
    
    
  • 相关阅读:
    修改Echarts 图表的坐标轴的文本的排列位置
    dataTable组件使用
    jeecg使用uploadify上传组件
    session属性的清除和非法登录
    Freemaker模板指令
    Freemarker的循环通过assign指令引入计数变量
    测试计划模板
    python+requests接口自动化测试框架实例详解教程(米兔888)
    jmeter(二十二)内存溢出原因及解决方法
    Jmeter(四)_逻辑控制器详解
  • 原文地址:https://www.cnblogs.com/shenxiaodou/p/12618364.html
Copyright © 2011-2022 走看看