ToString 어노테이션
· 테크· Spring
Spring
클래스의 toString 메서드를 자동으로 생성해주고 싶을 때 사용됩니다. @ToString(of={"ID", "NAME"}, includeFieldNames = false)와 같이 컬럼을 지정하는 방식으로 사용되기도 하고, 각 컬럼 위에 @ToString.Include 또는 @ToString.Exclude를 사용해서 컬럼별로 지정이 가능합니다.
@Entity
@ToString(of={"ID, NAME"})
public class Person {
long id;
String name;
int age;
}
// 다른 방식의 활용
@Entity
@ToString
public class Person {
@ToString.Include
long id;
@ToString.Include
String name;
@ToString.Exclude
int age;
}Comments
No comments yet. Be the first!
318 posts in 테크
- 341Migrating from Permanent Access Tokens to Token Exchange — Why Order Matters
- 326Startup & Product Glossary: Terms Every Solo Founder Should Know
- 325Context Management — How I Do It Now
- 324Claude Code Routines vs Cowork Schedule — What's the Difference?
- 323로컬 LLM + Claude Code로 PM 업무 자동화 에이전트 만들기
1–5 / 318