Spring-boot Project Commit

SangHyun-Park·2022년 3월 18일
0

스프링을 학습하다가 보니 문득 spring-boot 오픈 소스가 궁금해졌다.
사실 본질적인 프로젝트 내부 구조를 알지 못하고 프레임워크를 사용하는건 최고의 질의 reference 를 버리는 것과 같다.

아직 코드를 거시적인 관점으로 보는 능력이 부족하긴 하지만, 반복과 습관이 익숙함과 능력을 만든다는 것을 믿기 때문에 조금씩이나마 오픈소스를 들여다 보려고 한다.

Spring-boot 오픈소스의 몇가지 Commit 에 대해 찾고, 어떤 내용인지 간단하게 알아봤다.

첫번째 commit

우선 간단한 커밋부터 찾아 보았다.

1.1 commit 링크: https://github.com/spring-projects/spring-boot/commit/19ee1220a81b582b22ffc78550f55a8479877667

1.2 commit 메세지 해석: upgrade to Gradle 7.4.1

1.3 commit 코드 (주요)수정분 캡쳐:

  1. commit 코드 수정내용 간략해석:

springboot 핵심 빌드 툴인 gradle 의 version 을 7.4.0 -> 7.4.1 로 Upgrade 했다.

알 수 있는 점

gradle-conf-path : gradle/wrapper/gradle-wrapper.properties
distributionUrl : {gradle-download-URL}

두번째 commit 분석

2.1 commit 링크:
https://github.com/spring-projects/spring-boot/commit/a265f150acf0846ccecccd382ebc0adb190174b3

2.2 commit 메세지 해석:

생성자 파라미터로 들어온 numeric value 의 parsing 방식을 수정했다.

2.3 commit 코드 (주요)수정분 캡쳐:

2.4 commit 코드 수정내용 간략해석:

Previously, all integral numbers were parsed as integers. This
caused two problems:

이전에는 생성자 파라미터의 모든 입력 값이 정수로 parsing 되었는데, 이는 아래 두 문제를 야기한다.

  1. Compilation would fail if the default value for a long wasn't a
    valid integer.

long 으로 표현된 값이 integer 로 적절히 변환이 안되면(오버플로우?) 컴파일이 실패한다.

  1. The default value for a byte or short could be out of range,
    resulting in the generation of invalid metadata and an error
    that could have been caught at compile time not being caught
    until runtime.

역시나 반대로 byte 나 short 로 Integer 로 parsing 된 값이 들어가기 때문에 표현 범위를 넘어 런타임에서 오류가 발생하는 치명적인 상황

This commit updates the parsing of all numeric values to use the
parse method of the target primitive type. For example,
Short.parseShort(String) is now used to parse a short.

이 커밋을 통해 파싱법을 해당 값의 primitive type(byte short int …) 에 맞게 적용하도록 업데이트 했다.

세번째 commit 분석

3.1 commit 링크: https://github.com/spring-projects/spring-boot/commit/c1fec6967e388a2871a469cc98436e0d8e523697

3.2 commit 메세지 해석:

FailureAnalyzers 구현체의 생성자 주입 방식을 추가했다.

Support constructor injection for FailureAnalyzers

3.3 commit 코드 (주요)수정분 캡쳐:

Delete BeanFactoryAware interface
Delete BeanFactory setter injection
Add constructor injection

Delete EnvironmentAware interface
Delete Environment setter injection
Add constructor injection

Delete Setter injection
Add Constructor injection

Delete Setter injection
Add Constructor injection

3.4 commit 코드 수정내용 간략해석:

This commit adds support for instantiating FailureAnalyzer
implementations with BeanFactory and/or an Environment constructor
arguments and deprecates support for setter injection of these values
using BeanFactoryAware and EnvironmentAware.

setter injection 은 다양한 문제점을 발생시키기 때문에, BeanFactoryAware 과 EnvironmentAware 을 사용한 setter injection 구조를 삭제하고, BeanFactory 와 Environment 객체의 constructor injection 방식을 통해 FailureAnalyzer 의 구현체 instance 생성을 지원하는 방식을 추가했다.

profile
https://ppaksang.tistory.com/ 옮겼습니다 !!

0개의 댓글