전체 글
-
[03] 내장 Web Application ServerSpring/Spring boot 2020. 5. 20. 08:55
Spring boot 내장 WAS에 대해 살펴보기 전에 정확한 용어를 확인하도록 하겠습니다. 정적(static) page client에서 request가 있을 때 항상 정해진 내용으로만 response 하는 page를 말합니다. 정적인 요소는 html, css, 그 밖의 image를 포함한 resource들이 있습니다. 동적(dynamic) page client의 request에 대해 server에서 데이터를 가공하여 client에 맞는 내용을 response 하는 page를 말합니다. Web Server client의 request에 대해 정적인 page를 http protocol을 사용하여 제공합니다. client로 부터 동적 page에 대한 request를 받으면 이를 처리할 수 있는 contain..
-
[02] Spring boot 자동 설정Spring/Spring boot 2020. 5. 15. 09:28
[@SpringBootApplication annotation에 대해] Spring boot project를 생성하고 application을 실행하면 별다른 설정 없이도 실행이 가능합니다. 그 이유는 다음과 같이 @SpringBootApplication annotation안에 @EnableAutoConfiguration annotation이 선언되어 있기 때문입니다. ...(생략)... @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan( excludeFilters = {@Filter( ..
-
[01] Spring boot 의존성 관리Spring/Spring boot 2020. 5. 12. 07:57
[의존성을 어떻게 관리할까?] Web service를 위해 library 형태로 제공되는 많은 기능들이 존재합니다. 하지만 library도 지속적인 update가 있어 존재하던 기능이 없어지거나 새로운 기능이 추가될 수도 있고 기존 기능이 개선되면서 사양이 일부 변경되기도 하는 등의 변화가 있을 수 있으며 따라서 여러 가지 version이 존재합니다. Web service를 위해 여러 library 간의 협력이 요구되는데 이때 특정 version의 각 library들이 정상적으로 상호 동작하는지 확인해야 합니다. 즉, 상호 의존관계의 기능(의존성)들이 정상 동작하는지 확인하는 것입니다. Spring boot는 maven이나 gradle과 같은 build tool을 사용하여 이런 의존성 관리를 자동으로 해..
-
[00] Maven으로 Spring Boot Project 생성Spring/Spring boot 2020. 5. 11. 09:37
[Spring Boot Project 생성] IntelliJ에서 build tool 중 하나인 Maven을 사용하여 Spring boot project를 생성할 수 있습니다. (Gradle을 통한 project 생성은 여기를 참고해주세요.) + Create New Project를 클릭하여 Project 생성을 진행합니다. Maven을 선택하시고 다른 설정 없이 Next를 클릭합니다. ▶을 눌러 Aritifact Coordinates를 펼칩니다. GroupID는 사용자의 package명을 입력하시고 ArtifactId는 project 이름이므로 원하는 내용으로 입력해 주세요. (package는 URL의 역순으로 주로 입력합니다. 예를 들면 com.kakao.dev와 같은 형태입니다.) GroupID와 Ar..
-
[17] Null-SafetySpring/Spring 핵심 기술 2020. 5. 7. 18:34
Spring framework 5부터 compile time에 NullPointException을 최대한 방지하기 위한 annotation이 지원되고 있습니다. [Null-Safety 관련 annotation] @NonNull : 변수나 return value에 null을 허용하지 않을 경우 사용합니다. org.springframework.lang의 @NonNull을 사용해야 합니다. @Nullable : 변수나 return value에 null을 허용하는 경우 사용합니다. @NonNull과 마찬가지로 org.springframework.lang에 해당하는 annotation을 사용합니다. [Null-safety annotation 사용 위치] 변수 값의 null 허용 여부 : null을 확인할 변수 앞..
-
[16] Spring AOP (Proxy-based AOP)Spring/Spring 핵심 기술 2020. 5. 4. 08:54
Spring AOP는 Spring bean에만 적용할 수 있는 proxy pattern의 AOP 구현체입니다. [Proxy Pattern이란?] Proxy pattern은 software design pattern 중 하나입니다. 일반적으로 proxy란 실제 객체(여기서는 Spring bean)에 대한 interface 역할을 수행하는 class의 객체를 말합니다. proxy와 resource는 동일한 interface type을 구현합니다. proxy와 실제 객체는 동일한 interface type이기 때문에 동일한 책임(method)을 수행할 수 있어야 합니다. 하지만 proxy는 직접 책임을 수행하지 않고 실제 객체가 대신 처리하도록 delegation 합니다. 그렇기 때문에 proxy는 실제 객체..
-
[15] Aspect Oriented Programming 의 개념Spring/Spring 핵심 기술 2020. 5. 2. 07:31
먼저 Aspect Oriented Programming관 관련된 용어를 정리하도록 하겠습니다. Aspect : aspect의 사전적 뜻은 "측면", "양상"입니다. programming code에서 동일한 양상의 code(crosscutting concerns)들을 한 곳에 모아 관리하는 것이 aspect 입니다. Target : aspect의 advice(code)를 적용할 대상입니다. Advice : concern들을 모아 aspect에서 관리하는 code입니다. aspect를 통해 target에서 수행됩니다. Join point : code의 흐름 중 aspect의 advice를 적용할 point 입니다. 생성자 호출 직전, 생성자 호출 시, field 접근 전 filed에서 값을 가져갔을 때 me..
-
[14] Spring Expression Language (SpEL)Spring/Spring 핵심 기술 2020. 4. 29. 09:42
Spring Expression Language는 객체 graph를 조회하고 조작하는 기능을 제공하는 expression language입니다. method 호출과 문자열 template 기능을 제공하며 Spring project 전반에 걸쳐 사용할 목적으로 만들어졌습니다. SpEL의 구성 ExpressionParser parser = new SpelExpressionParser() StandardEvaluationContext context = new Standard EvaluationContext (bean)-->EvalucationContext를 통해 등록된 bean의 method는 SpEL을 통해 접근할 수 있습니다. Expression expression = parser.parseExpressi..