- @GetMapping : 메서드 레벨, GET 요청을 처리할 수 있다.
- @Controller : @GetMapping, @PostMapping, @PutMapping, @DeleteMapping 등을 사용할 수 있다.
- @ResponseBody : 메서드의 반환값을 응답 본문으로 사용
- @RestController : @Controller + @ResponseBody
- @Component : 스프링 IoC 컨테이너에 등록, new 로 생성할 필요가 없어진다.
- @Controller : 이것도 컴포넌트의 일종이다.
- @Service : @Component 과 동일
- @Repository : @Component 과 동일
- @Bean : 메서드 레벨, 스프링 IoC 컨테이너에 등록, new 로 생성할 필요가 없어진다.
- 메서드로 빈을 등록하는 방법
- 주로 직접 만든 클래스가 아닌 클래스를 빈으로 등록할 때 사용된다.
- @Configuration : 클래스 레벨, @Bean 을 사용할 수 있다.
날짜 자동
- @EnableJpaAuditing - 실행시키는 파일에 작성 (JpaApplication)
- @EntityListeners(AuditingEntityListener.class) - 클래스에 작성
- @CreatedDate, @LastModifiedDate - 변수에 작성
'BE > Spring & Spring Boot' 카테고리의 다른 글
[Spring Boot] 빈이란 (1) | 2024.12.15 |
---|---|
[Spring Boot] ApplicationRunner (0) | 2024.12.14 |
[Spring Boot] ORM, @Query (1) | 2024.12.14 |
[Spring] Spring 과 Spring Boot (0) | 2024.12.13 |
[Sping Boot] Spring Initializr, 프로젝트 구조 (0) | 2024.12.10 |