An open API service indexing awesome lists of open source software.

https://github.com/nesoy/springboot-starter-example

🌺 Introducing Springboot-starter
https://github.com/nesoy/springboot-starter-example

example spring

Last synced: 5 months ago
JSON representation

🌺 Introducing Springboot-starter

Awesome Lists containing this project

README

          

## Spring-boot-Starter Tutorial
#### Goals
- Springboot Starterλ₯Ό 직접 λ§Œλ“€λ©΄μ„œ μ–΄λ–»κ²Œ κ΅¬μ„±λ˜μ–΄ μžˆλŠ”μ§€ μ΄ν•΄ν•΄λ΄…μ‹œλ‹€.

## Let's make custom-springboot-starter
#### 1. Create Multi Moudle Project
- springboot-starter의 예제λ₯Ό λ§Œλ“€κΈ° μœ„ν•΄μ„  총 3κ°€μ§€μ˜ λͺ¨λ“ˆμ΄ ν•„μš”ν•©λ‹ˆλ‹€.
- μžλ™ ν™˜κ²½μ„€μ • λͺ¨λ“ˆ
- μžλ™ ν™˜κ²½μ„€μ •μ„ ν¬ν•¨ν•œ λͺ¨λ“ˆ
- Starterλ₯Ό ν…ŒμŠ€νŠΈ ν•˜λ €λŠ” Web Application
- [springboot-starter λͺ¨λ“ˆμ˜ 이름을 μž‘μ„±ν•˜κΈ° 전에 μ£Όμ˜ν•΄μ•Ό ν•  점듀이 μžˆμŠ΅λ‹ˆλ‹€.](https://docs.spring.io/autorepo/docs/spring-boot/2.0.0.M3/reference/html/boot-features-developing-auto-configuration.html#boot-features-custom-starter-naming)
- Springμ—μ„œλŠ” λͺ¨λ“ˆμ˜ 이름을 `spring-boot`둜 μ‹œμž‘ν•˜μ§€ μ•Šμ„ 것을 κΆŒν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
- μ•„λž˜μ™€ 같이 μ•žμ— λ‹€λ₯Έ 이름을 뢙이기λ₯Ό κΆŒν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
- `nesoy-spring-boot-autoconfigure`
- `nesoy-spring-boot-starter`
- λ©€ν‹° λͺ¨λ“ˆλ‘œ ν”„λ‘œμ νŠΈ κ΅¬μ„±ν•˜κΈ°
- [Maven으둜 ꡬ성해보기](https://taetaetae.github.io/2020/01/19/spring-boot-maven-multi-module/)
- [Gradle둜 ꡬ성해보기](https://jojoldu.tistory.com/123)

- Gradle둜 κ΅¬μ„±ν•˜λ©΄ λ‹€μŒκ³Ό 같은 λͺ¨μŠ΅μ„ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.
```shell script
.
β”œβ”€β”€ build.gradle
β”œβ”€β”€ nesoy-spring-boot-autoconfigure -> μžλ™ ν™˜κ²½μ„€μ •μ„ μœ„ν•œ λͺ¨λ“ˆ
β”‚Β Β  β”œβ”€β”€ build.gradle
β”‚Β Β  └── src
β”œβ”€β”€ nesoy-spring-boot-starter-example -> μžλ™ ν™˜κ²½μ„€μ •μ„ ν¬ν•¨ν•œ λͺ¨λ“ˆ
β”‚Β Β  └── build.gradle
β”œβ”€β”€ nesoy-spring-boot-starter-web -> Starter ν…ŒμŠ€νŠΈλ₯Ό μœ„ν•œ μ–΄ν”Œλ¦¬μΌ€μ΄μ…˜
β”‚Β Β  β”œβ”€β”€ build.gradle
β”‚Β Β  └── src
└── settings.gradle
```

#### 2. Setting Auto-Configure Module 🐳
- Springboot의 μžλ™ 섀정을 μ‚¬μš©ν•˜κΈ° μœ„ν•΄ μ•„λž˜μ˜ μ˜μ‘΄μ„±μ„ μΆ”κ°€ν•΄μ€λ‹ˆλ‹€.
- [Springboot-AutoConfigure](https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-autoconfigure)

```shell script
# gradle
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: '2.3.1.RELEASE'

# Maven

org.springframework.boot
spring-boot-autoconfigure
2.3.1.RELEASE

```

- Starter에 ν•„μš”ν•œ μ„€μ •νŒŒμΌμ„ λ§Œλ“€μ–΄λ΄…μ‹œλ‹€.
- [@ConfigurationProperties](https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/context/properties/ConfigurationProperties.html)
- [Reference](https://velog.io/@max9106/Spring-Boot-%EC%99%B8%EB%B6%80%EC%84%A4%EC%A0%95-4xk69h8o50)
```java
@ConfigurationProperties(prefix = "nesoy")
public class NesoyProperties {

private String log;

public String getLog() {
return log;
}

public void setLog(String log) {
this.log = log;
}
}
```

## μžλ™ ν™˜κ²½μ„€μ •μ„ ν¬ν•¨ν•œ λͺ¨λ“ˆ μ…‹νŒ…

## μš°λ¦¬κ°€ λ§Œλ“  Starter μ‚¬μš©ν•΄λ³΄κΈ°

## Reference
-
-
-
-