zoukankan      html  css  js  c++  java
  • lombok插件:Data自动get/set方法, Slf4j实现Logger的调用

    lombok插件:Data自动get/set方法, Slf4j实现Logger的调用

    lombok.Data

    import lombok.Data;
    import org.hibernate.annotations.DynamicUpdate;
    
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import java.io.Serializable;
    import java.sql.Date;
    
    @Entity
    @Data //默认添加get/set/toString方法
    @DynamicUpdate //update_timestamp自动更新时间
    public class ProductCategory implements Serializable {
    
    	@Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Integer categoryId;
    
        private String categoryName;
    
        private Integer categoryType;
    
        private Date createTimestamp;
    
        private Date updateTimestamp;
    
        public ProductCategory()
        {
    
        }
        public ProductCategory(String categoryName, Integer categoryType)
        {
            this.categoryName = categoryName;
            this.categoryType = categoryType;
        }
    
    }
    

      

    lombok.extern.slf4j.Slf4j
    import lombok.extern.slf4j.Slf4j;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.boot.test.context.SpringBootTest;
    import org.springframework.test.context.junit4.SpringRunner;
    
    @RunWith(SpringRunner.class)
    @SpringBootTest
    @Slf4j
    public class LoggerTest {
    
        //private static final Logger log = LoggerFactory.getLogger(LoggerTest.class);
    
        @Test
        public void test1()
        {
            String name= "zhangsan";
            String password = "123456";
    
            log.debug("debug:  "+name+",  "+password);
            log.info("info: {}, {}", name, password);
            log.error("error...... ");
    
        }
    }
    

      

  • 相关阅读:
    linux设备模型
    dma
    POSIX thread
    Network: IP QoS
    TCP: sliding window of flow control
    TCPIP: UDP/TCP checksum
    Hebrew: Learning Resources
    Vivado: Uninstall Vivado on ubuntu/linux
    HLS: vivado_hls compile fail, csim and csyn error, no ip generated for udpLoopback and toe
    HLS: High-Level Synthesis Operators
  • 原文地址:https://www.cnblogs.com/achengmu/p/9944796.html
Copyright © 2011-2022 走看看