<spring>/기초 Spring Basic

[파편 조각 - Spring Web] Service

Rizingblare 2023. 9. 26. 15:48

Spring WEB

DS -> Controller -> Service -> JPARepository

 

ex) 유저

 

클래스에 @Service Annotation 달기

@Service
public class UserService {
}

@RequiredArgsConstructor을 안달아주면 Repository를 DI하려고 할 때,

`Variable 'userJPARepository' might not have been initialized`

이런 알림창이 겁나 떠대니 요 Annotation도 달아줘야 한다.