스프링 이니셜라이저를 사용하지 않고 스프링부트 프로젝트 시작하기
build.gralde
코드의 역할 알기gradle 7.4.2 변경 -> plugins 사용
출처 : https://docs.gradle.org/current/userguide/plugins.html
buildscripts 을 통해 spring boot로 바꾸지 않고, gradle 7.4.2 에서는 plugins
를 통해 간단하게 plugin을 적용할 수 있도록 한다.
// 아래 4개의 플러그인은 자바와 스프링 부트를 사용하기 위한 필수 플러그인들
plugins {
id 'java'
id 'eclipse'
id 'org.springframework.boot' version '2.1.7.RELEASE'
id 'io.spring.dependency-management' version "1.0.11.RELEASE"
}
이렇게 적용함해 build script
를 통한 적용보다 몇 가지 좋은 점이 있다.
재사용을 높이고 여러개의 프로젝트 사이 비슷한 logic을 유지하는 overhead를 줄인다
이해성과 조직성을 강화시켜 더 높은 수준의 모듈화를 가능하게 한다.
반드시 필요한 로직을 캡슐화하고 build script를 최대한 명시적으로 사용할 수 있다.
Promotes reuse and reduces the overhead of maintaining similar logic across multiple projects
Allows a higher degree of modularization, enhancing comprehensibility and organization
Encapsulates imperative logic and allows build scripts to be as declarative as possible
--> 왜 인지는 아직 잘 모르겠다..
프로젝트 개발에 필요한 의존성들 추가하는 곳
dependencies { // 프로젝트 개발에 필요한 의존성 선언
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
기존 | 대체 |
---|---|
compile | implementation |
testCompile | testImplmentation |
debugCompile | debugImplementation |
androidTestCompile | androidTestImplementation |
! 기능적으로 기존 complie은 api
가 대체한다.
build.gradle filedp 변경 사항이 발생할 경우 이런 버튼이 뜨고 클릭할 경우 그레이들이 변경 사항을 반영하기 시작한다.
결과는
이렇게 확인 가능!