不要企图无所不知,否则你将一无所知。——佚名
在r2dbc
中自动填充审计字段可以使用org.springframework.data.annotation.CreatedDate
注解
以及org.springframework.data.annotation.LastModifiedDate
例如:
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import java.time.LocalDateTime;
/**
* RtcInspectLog
*
* @author achao@apache.org
*/
@Data
public class RtcInspectLog {
private Long id;
@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
private LocalDateTime updatedAt;
}
然后需要配置org.springframework.data.r2dbc.config.EnableR2dbcAuditing
例如
@Configuration
@EnableR2dbcAuditing
class Config {}
即可自动填充
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有