2.lombook插件

/**
 * lombook的学习使用
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Article {


    /**
     * id : 1
     * author : 莫言
     * age : 30
     * addr : 深圳宝安
     */

    private int id;
    private String author;
    private int age;
    private String addr;

}
package com.zimug.bootlaunch.controller;

import com.zimug.bootlaunch.model.Article;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class HelloController {

    @GetMapping("/hello")
    public Article hello() {
        Article article = Article.builder().id(1).author("莫言").age(30).addr("深圳宝安").build();
        log.info("设置id成功");
        log.info("设置author成功");
        return article;
    }
}

你可能感兴趣的:(2.lombook插件)