Skip to content

Java Annotation ์ •๋ฆฌ

Minjae Lee edited this page Apr 16, 2024 · 9 revisions

Common Java Annotation

Annotation Description
@Component ํ•ด๋‹น ํด๋ž˜์Šค๋ฅผ Bean์œผ๋กœ ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค.
-> @ComponentScan์— ์˜ํ•ด ํ•ด๋‹น ์–ด๋…ธํ…Œ์ด์…˜์ด ๋ถ™์–ด์žˆ๋Š” ํด๋ž˜์Šค๋ฅผ ์ž๋™์œผ๋กœ ์ฐพ์•„ Spring IoC ์ปจํ…Œ์ด๋„ˆ์— Bean ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•ด์„œ ํ•ด๋‹น ์ธ์Šคํ„ด์Šค๋ฅผ ์˜์กด๊ฐ€๋Šฅํ•˜๋„๋ก ๋งŒ๋“œ๋Š” ๋…€์„์ž…๋‹ˆ๋‹ค.
@Bean
@Autowired
@AllArgsConstructor
@RequiredArgsConstructor
@NoArgsConstructor

Entity File Java Annotation

Annotation Description
@Entity
@Getter
@Id
@GeneratedValue
@Enumerated

Controller File Java Annotation

Annotation Description
@Controller
@RestController
@RequestMapping
@RequestBody
@PathVariable

Service File Java Annotation

Annotation Description
@Service
@Builder
@Transactional
Clone this wiki locally