-
Notifications
You must be signed in to change notification settings - Fork 0
04) helloSpringboot
- ์์ฐ์ฑ
- Time to Market - ์ ์์ ์ถ์ํ๋๊ฒ ์ค์ํ๊ธฐ ๋๋ฌธ.
auto-configuration - ๊ด๋ จ๋ ํด๋์ค๊ฐ ์์.
props files & JAR classpath์ ๊ธฐ๋ฐ์ผ๋กํด์ ์๋์ผ๋ก ์ค์ ํจ.
xml ํ์ผ์ ๋ง๋ค์ด ์ค ํ์๊ฐ ์๋ค.๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ์ ๋ฒ์ ์ถฉ๋์ด ๋ฐ์ ํ ์ ์๋๋ฐ ๊ด๋ จ๋๊ฑธ ์ธํ
์ ํ๋ฆฌ์ผ์ด์ ์์ ๋ด์ฅ ์๋ฒ๋ฅผ ๊ฐ์ง๊ณ ์์ด์ ๋ณ๋ ์ค์น ์์ด ๋น ๋ฅด๊ฒ ์์ ํ ์ ์๋ค.
๋์ผํ ์์ ์ ๋ฐ๋ณตํ๋๊ฒ์ ์๋ํ ํ๋ค.
idea : Spring ์ด ์๋์ผ๋ก bean์ ์ค์
idea : customize ํ๊ฒ ์ค์ ์ด ํ์ํ ์ ๋ ์๊ธฐ ๋๋ฌธ์, properties์ ํตํด cusomizeํ๋ค.spring mvc jar๊ฐ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ถ๊ฐ๋ ๋, auto configure ํ๋๋ก ํ๋จ.
-> spring mvc jar ๊ฐ classpath ๊ฐ ์๋ค๋ฉด, Dispatcher Servlet์ ์๋ ์ค์ ํ๋ค. (์กฐ๊ฑด์ ๋ฐ๋ผ ์๋ ์ค์ ํจ)
//@SpringBootApplication : Annotation์ ์กฐํฉ
@Configuration
@EnabledAutoConfiguration // ์๋ ์ค์ ๊ธฐ๋ฅ ํ์ฑํ
@ComponentScan
public class Application {
~~
}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Spring - core, beans, context, aop
Web MVC - (Spring MVC)
Jackson - for JSON Binding
Validation - Hibernate Validator, Validation API
Embedded Servlet Container - Tomcat
Logging - logback, slf4j
main() ๋ฉ์๋๊ฐ ์์๋๋ฉด, ๋ด์ฅ์๋ฒ๋ฅผ ์คํ์ํจ๋ค.
์ธ๋ถ์ ํฐ์ผ ์๋ฒ์์ ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ฐฐํฌํ ํ์๊ฐ ์๋ค.
'war' ํ์ผ์ด ์๋ 'jar' ๋ก ํจํค์ง์ด ์ด๋ฃจ์ด์ง๋ค.
์ ํ๋ฆฌ์ผ์ด์ monitoring , tracing
์ดํ๋ฆฌ์ผ์ด์ ์ ์๋น์คํ ๋ ์ค์ํ๋ค.
REST endpoints ๋ฅผ ์๋์ ์ผ๋ก ์ถ๊ฐํด์ค๋ค.
EX) /beans, /mappings
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
default : /heath and /info ๊ฐ ๋ ธ์ถ๋์ด ์์.
Endpoints are prefixed with : /actuator -> /acutator/health