스크린샷 2025-09-19 오전 9.43.13.png

스크린샷 2025-09-19 오전 10.28.44.png

jpa에게 상속받아 사용할 수 있는 메서드들

스크린샷 2025-09-19 오전 10.29.27.png

Optional타입

    // <https://mvnrepository.com/artifact/org.modelmapper/modelmapper>
    implementation 'org.modelmapper:modelmapper:3.1.1'

스크린샷 2025-09-19 오전 10.36.23.png

**@Configuration**
public class AppConfig {
    
    /* 설명. 미리 dependency로 추가해 둘 것 */
    /* 설명. DTO <-> Entity 매핑을 위한
    *       ModelMapper 라이브러리 bean 추가 */
    **@Bean
    public ModelMapper modelMapper(){
        return new ModelMapper();
    }**	  // 객체를 매번 새로 생성해야되서 미리 만들어 놓음
}
**private final ModelMapper modelMapper;**

@Autowired
public MenuService(MenuRepository menuRepository,
                       ModelMapper modelMapper) {
    this.menuRepository = menuRepository;
    **this.modelMapper = modelMapper;**
}
**return modelMapper.map(menu, MenuDTO.class);**

게시글은 최신순으로 올라와야 한다.