zoukankan      html  css  js  c++  java
  • Spring Boot学习笔记

    例子1:   http://spring.io/guides/gs/rest-service/

    字符串填充,如%s

    private static final String template = "Hello, %s!";
    String name = "wwj";
    String.format(template, name);

    自增类型

    private final AtomicLong counter = new AtomicLong();
    counter.incrementAndGet();

    @RequestMapping  @RequestParam

    @RequestMapping("/greeting")
    public Greeting greeting(@RequestParam(value="name", defaultValue="World"){...}

    例子2:   http://spring.io/guides/gs/scheduling-tasks/

    按格式输出时间

    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    dateFormat.format(new Date());

    @Scheduled  定时运行

    @Scheduled(fixedRate = 5000);     //加在一个小函数前面
    @EnableScheduling //加在程序主入口前面

    例子3:  http://spring.io/guides/gs/device-detection/

    @ResponseBody 转为HTTP返回

    public @ResponseBody String detectDevice(Device device) {
        ...
        return "Hello " + deviceType + " browser!";
    }

    设备类型判断

    import org.springframework.mobile.device.Device;
    Device device;
    device.isNormal();
    device.isMobile();
    device.isTablet();
  • 相关阅读:
    MySQL
    php抽象类和接口
    php面向对象三大特征
    php面向对象
    Git
    css3属性
    数据渲染
    ajax(2)
    ajax笔记
    作用域面试题
  • 原文地址:https://www.cnblogs.com/wwjyt/p/5309441.html
Copyright © 2011-2022 走看看