전체 글 (291) 썸네일형 리스트형 [Annotation] Spring Bean Annotations https://www.baeldung.com/spring-bean-annotations 애노테이션 시리즈 마지막~~!! Spring 컨테이너에서 빈을 구성하는 방법 1. XML 구성을 사용하여 선언 2. 구성 클래스에서 @Bean 애노테이션 사용 3. org.springframework.stereotype 패키지 의 주석 중 하나로 클래스를 표시 (leave the rest to component scanning) Component Scanning Spring은 Component Scanning이 활성화된 경우 bean에 대한 패키지를 자동스캔할 수 있다 @ComponentScan은 어노테이션 구성으로 클래스를 검색할 패키지를 구성한다 // basePackages 또는 값 인수 중 하나를 사용하여 기본 .. [Annotation] Spring Data Annotations https://www.baeldung.com/spring-data-annotations Spring Data provides an abstraction over data storage technologies. Therefore, our business logic code can be much more independent of the underlying persistence implementation. Also, Spring simplifies the handling of implementation-dependent details of data storage. In this tutorial, we'll see the most common annotations of the Spring Data, Sprin.. [Spring MVC] @Controller 와 @RestController 차이 https://www.baeldung.com/spring-controller-vs-restcontroller Spring 4.0은 RESTful 웹 서비스 생성을 단순화하기 위해 @RestController 주석을 도입했다. @Controller 와 @ResponseBody를 결합한 편리한 주석으로 컨트롤러 클래스의 모든 요청 처리 메서드에 @ResponseBody 주석을 달 필요가 없다. Spring MVC @Controller simply a specialization of the @Component class, which allows us to auto-detect implementation classes through the classpath scanning. typically use @Contr.. [Annotation] Spring Scheduling Annotations https://www.baeldung.com/spring-scheduling-annotations org.springframework.scheduling.annotation 단일 thread 보다 더 복잡한 실행이 필요할 경우에 사용함 @EnableAsync 이 애노테이션은 Spring에서 비동기 기능을 활성화 한다 @Configuration 과 함께 사용해야 한다 *** @Configuration @EnableAsync class VehicleFactoryConfig {} 이렇게 비동기 호출을 활성화 시킨 후 원하는 메서드에 @Async 를 붙여서 정의하면 된다 @EnableScheduling 이 애노테이션을 사용하여 스케쥴링을 활성화 한다 @Configuration 과 함께 사용해야 한다 *** @C.. [Annotation] Spring Web Annotations https://www.baeldung.com/spring-mvc-annotation org.springframework.web.bind.annotation package. @RequestMapping request handler methods inside @Controller classes path, or its aliases, name, and value: which URL the method is mapped to method: compatible HTTP methods params: filters requests based on presence, absence, or value of HTTP parameters headers: filters requests based on presence, abse.. [Annotation] Spring Core Annotations https://www.baeldung.com/spring-core-annotations org.springframework.beans.factory.annotation and org.springframework.context.annotation packages. * DI 관련 주석 @Autowired We can use the @Autowired to mark a dependency which Spring is going to resolve and inject. 생성자주입: class Car { Engine engine; @Autowired Car(Engine engine) { this.engine = engine; } } Setter injection: class Car { Engine engine; .. [Annotation] Spring Boot Annotations https://www.baeldung.com/spring-boot-annotations org.springframework.boot.autoconfigure org.springframework.boot.autoconfigure.condition @SpringBootApplication Spring Boot application base class @Configuration, @EnableAutoConfiguration, @ComponentScan 애노테이션을 기본 속성으로 캡슐화함 @SpringBootApplication class VehicleFactoryApplication { public static void main(String[] args) { SpringApplication.run(Vehicl.. [Spring] 요청에 따른 부가응답 추가하기 https://meetup.nhncloud.com/posts/148 Spring에서 요청에 따른 부가 응답 추가하기 (1) : NHN Cloud Meetup Spring에서 요청에 따른 부가 응답 추가하기 (1) meetup.nhncloud.com 해당 출처를 이용하여 코드 작성했습니다. 해당 블로그에서 MicroService 를 베이스로 사용한 부가 처리 작업 예시가 있어서 읽어보았다. OOP 의 특성을 최대한 살려서 코드를 작성했다고 하는데, 정리하자면 Interceptor를 이용하여 부가작업을 처리해주는 코드였다 테스트 코드도 있어서 공부하기에 적합할 것 같아 위의 링크 내용을 참조하여 나에게 맞게 코드를 작성해봤다 기본 API 에 기능을 추가한 것으로 구현 방법은 아래와 같다. 기본 API에 at.. 이전 1 ··· 15 16 17 18 19 20 21 ··· 37 다음