IT개발2 [Spring] @SpringBootApplication 어노테이션 @SpringBootApplication은 아래 어노테이션을 추가한 편의성 어노테이션입니다. @Configuration 애플리케이션 컨텍스트에 대한 빈 정의 소스로 클래스에 태그를 지정합니다. @EnableAutoConfiguration Spring Boot에 클래스 경로 설정, 기타 Bean들과 다양한 property 설정을 기반으로 bean을 추가하도록 한다. 예를 들어 spring-webmvc가 클래스 경로에 있는 경우 이 어노테이션은 애플리케이션에 웹 애플리케이션으로 플래그를 지정하고 DispatcherServlet 설정과 같은 주요 동작을 활성화합니다. @ComponentScan Spring이 예를들어 com/example/demo 패키지에서 선언된 components, configuration.. 2022. 3. 15. [Spring] 스프링 웹 어노테이션 (Spring Web Annotation) Spring에서의 Spring Web 어노테이션을 이용하여 RESTful 웹 서비스를 만들어보자. http://localhost:8080/greeting API GET 요청으로 아래의 JSON 응답을 받는 API를 작성해보자. {"id":1,"content":"Hello, World!"} 먼저 greeting 모델 클래스를 만들자. package com.example.demo; public class Greeting { private final long id; private final String content; public Greeting(long id, String content) { this.id = id; this.content = content; } public long getId() { ret.. 2022. 3. 15. 이전 1 다음