Spring VS Spring Boot

hyyyynjnยท2021๋…„ 7์›” 3์ผ
1
post-thumbnail

โœ…Spring ์ƒํƒœ๊ณ„

  • Spring์„ ํ†ตํ•ด ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

  • Spring์€ ํ”„๋กœ์ ํŠธ ๋ณ„๋กœ ํ•˜์œ„ ํ”„๋กœ์ ํŠธ(๋ชจ๋“ˆ)์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.
    • Spring Data๋ผ๋Š” ํ”„๋กœ์ ํŠธ์˜ Spring Data JDBC, Spring Data JPA๋“ฑ์˜ ํ•˜์œ„ ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•˜๊ธฐ์œ„ํ•ด์„œ Spring Framework๋ผ๋Š” ํ”„๋กœ์ ํŠธ๊ฐ€ ํ•„์š”ํ•˜๋‹ค
      • ๐Ÿ‘‰ Spring Framework ํ”„๋กœ์ ํŠธ๋Š” ์Šคํ”„๋ง์˜ ๊ฐ€์žฅ ํ•ต์‹ฌ ํ”„๋กœ์ ํŠธ์ด๋‹ค.

  • ๐Ÿ‘‰ ์—ฌ๋Ÿฌ Spring ํ”„๋กœ์ ํŠธ๋“ค ์ค‘ ๊ฐ€์žฅ ๊ธฐ๋ณธ์ด ๋˜๋Š” ํ”„๋กœ์ ํŠธ๋Š” Spring Framework, Spring Boot ํ”„๋กœ์ ํŠธ์ด๋‹ค.

โœ…Spring Framework

  • ๐Ÿ‘‰ Spring Framework๋Š” ๊ฐ์ฒด ์ง€ํ–ฅ์˜ ํŠน์ง•์„ ์ž˜ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋ฉฐ, ๊ฐœ๋ฐœ์ž๋“ค์€ ํ•ต์‹ฌ ๋น„์ง€๋‹ˆ์Šค ๋กœ์ง ๊ตฌํ˜„์—๋งŒ ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ํ”„๋ ˆ์ž„์›Œํฌ์ด๋‹ค.
    • ๐Ÿ“ข์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ํ™˜๊ฒฝ
      • ๋Œ€๊ทœ๋ชจ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ์™€ ํŠธ๋žœ์žญ์…˜์ด ๋™์‹œ์— ์—ฌ๋Ÿฌ ์‚ฌ์šฉ์ž๋กœ๋ถ€ํ„ฐ ํ–‰ํ•ด์ง€๋Š” ํฐ ๊ทœ๋ชจ์˜ ํ™˜๊ฒฝ์„ ๋งํ•œ๋‹ค.

  • ๐Ÿ“ขSpring Framework์˜ ๊ธฐ๋ณธ ์ „๋žต
    • ๋น„์ง€๋‹ˆ์Šค ๋กœ์ง์„ ๋‹ด๋Š” ์ฝ”๋“œ์™€ ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ๊ธฐ์ˆ ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๋ถ„๋ฆฌ์‹œํ‚ค๋Š” ๊ฒƒ
      • ๐Ÿ‘‰ ๊ทธ๋ ‡๊ฒŒ ๋˜๋ฉด, ๊ฐœ๋ฐœ์ž๋Š” ๊ฐ์ฒด ์ง€ํ–ฅ์  ์„ค๊ณ„์—๋งŒ ์ดˆ์ ์„ ๋งž์ถœ ์ˆ˜ ์žˆ๊ฒŒ๋œ๋‹ค.
    • DI, IoC ๊ธฐ๋Šฅ์„ ํ†ตํ•ด ๊ฐ์ฒด ์ง€ํ–ฅ์˜ ํŠน์ง•์ค‘ "๋‹คํ˜•์„ฑ"์„ ๊ทน๋Œ€ํ™” ์‹œํ‚จ๋‹ค
      • ๐Ÿ‘‰ ์ด๋ฅผ ํ†ตํ•ด, ์žฌ์‚ฌ์šฉ๊ณผ ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ฒŒ ๋˜์–ด ํ™•์žฅ ๊ฐ€๋Šฅํ•˜๊ณ , ๋Š์Šจํ•˜๊ฒŒ ๊ฒฐํ•ฉ๋œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

โœ…Spring Boot

  • Spring Boot๋Š” Spring ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‰ฝ๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค€๋‹ค.

  • ์ƒˆ๋กœ์šด ๊ธฐ์ˆ ์ด ๋งŒ๋“ค์–ด์ง€๋ฉด์„œ ๊ฐœ๋ฐœ์ž๊ฐ€ ์ฒ˜๋ฆฌํ•ด์•ผํ•  ์„ค์ •์ด ๋งŽ์•„์ง€๊ณ  ๋ณต์žกํ•ด์ง
    • ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด, Spring Boot๋ผ๋Š” ์„œ๋ธŒ ํ”„๋กœ์ ํŠธ๊ฐ€ ์ง„ํ–‰๋จ.
    • Spring Framework๋ฅผ ์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ๐Ÿ”จ๋„๊ตฌ์ผ ๋ฟ์ด๋‹ค.

โœ…Spring VS Spring Boot

  • Spring๊ณผ Spring Boot์˜ ๋ชฉ์ ์ด ์„œ๋กœ ๋‹ค๋ฅด๋‹ค

๐Ÿ‘Spring์˜ ๋ชฉ์ 

๐Ÿ“Œ DI ์˜์กด์„ฑ ์ฃผ์ž…

  • ๊ฐ์ฒด๊ฐ„์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถ”์–ด ์ฝ”๋“œ ์žฌ์‚ฌ์šฉ์„ฑ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ณ , ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ์šฉ์ดํ•˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค€๋‹ค.

๐Ÿ“Œ ์ค‘๋ณต ์ฝ”๋“œ ์ œ๊ฑฐ

  • ๋ฐ˜๋ณต๋˜๋Š” ์ฝ”๋“œ๋“ค์„ ์ œ๊ฑฐํ•˜์—ฌ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์—๋งŒ ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค€๋‹ค.

๐Ÿ“Œ ๋‹ค๋ฅธ Framework์™€์˜ ํ†ตํ•ฉ

  • Mockito์™€ ๊ฐ™์€ ๋‹ค๋ฅธ ํ”„๋ ˆ์ž„์›Œํฌ์™€ ํ†ตํ•ฉํ•˜์—ฌ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์™ธ์— ์‹ ๊ฒฝ์“ธ ๋ถ€๋ถ„์„ ์ค„์—ฌ์ค€๋‹ค.

๐Ÿ‘Spring Boot์˜ ๋ชฉ์ 

๐Ÿ“Œ Auto Configuration ์ž๋™ ์„ค์ •

๐Ÿ“ข1. ์Šคํ”„๋ง ๊ธฐ๋Šฅ์„ ์œ„ํ•œ ์ž๋™ ์„ค์ •์„ ์ง€์›ํ•œ๋‹ค

  • โœSpring Boot๋Š” Bean์„ ๋‘ ๋ฒˆ์— ๊ฑธ์ณ ๋“ฑ๋กํ•œ๋‹ค.
    1. @ComponentScan
    • Spring๊ณผ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ Component scan์„ ํ†ตํ•ด Component๋ฅผ ์ฐพ๊ณ  Bean ์ƒ์„ฑ์„ ์ง„ํ–‰ํ•œ๋‹ค.
      • ์ด ๊ณผ์ •์—์„œ ๊ฐœ๋ฐœ์ž๊ฐ€ ์„ค์ •ํ•œ Bean๋“ค์ด ์ƒ์„ฑ๋œ๋‹ค.
        • @Controller, @RestController, @Service, @Repository ๋“ฑ๊ณผ ๊ฐ™์ด @component ์–ด๋…ธํ…Œ์ด์…˜์„ ์„ ์–ธํ•œ ํด๋ž˜์Šค๋“ค โž• @Configuration์— ๋“ฑ๋กํ•œ @Bean๊ณผ ๊ฐ™์€ ์„ค์ •๋“ค
    1. @EnableAutoConfiguration
    • ์ถ”๊ฐ€์ ์ธ Bean๋“ค์„ ์ฝ์–ด์„œ ๋“ฑ๋กํ•œ๋‹ค.
      • spring.factories ์•ˆ์— ๋“ค์–ด์žˆ๋Š” ์ˆ˜๋งŽ์€ ์ž๋™ ์„ค์ •๋“ค์ด ์กฐ๊ฑด์— ๋”ฐ๋ผ ์ ์šฉ์ด ๋˜์–ด ์ˆ˜ ๋งŽ์€ Bean๋“ค์ด ์ƒ์„ฑ๋œ๋‹ค.
    • ๐Ÿ‘‰ Component scan์„ ํ†ตํ•ด์„œ ๋ชจ์€ component๋“ค์˜ ์ •๋ณด์™€
      spring.factories ํŒŒ์ผ์— ์‚ฌ์ „ ์ •์˜ํ•œ auto-configuration ๋‚ด์šฉ์œผ๋กœ Bean ์ƒ์„ฑ์„ ์ง„ํ–‰ํ•œ๋‹ค.

  • โœ@SpringBootApplication ์–ด๋…ธํ…Œ์ด์…˜
    • @SpringBootConfiguration
      • Spring boot์˜ ์„ค์ •์„ ๋‚˜ํƒ€๋‚ด๋Š” ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ, Spring์˜ @Configuration์„ ๋Œ€์ฒดํ•œ๋‹ค.
      • Spring ์ œ๊ณต ํ…Œ์ŠคํŠธ(@SpringBootTest, @WebMvcTest)์‹œ ํ•ด๋‹น ์–ด๋…ธํ…Œ์ด์…˜์ด ์—†์œผ๋ฉด ์‹คํŒจํ•œ๋‹ค.
    • @ComponentScan
      • basePackages ํ”„๋กœํผํ‹ฐ ๊ฐ’์— ๋ณ„๋„์˜ ๊ฒฝ๋กœ๋ฅผ ์„ค์ •ํ•˜์ง€ ์•Š์œผ๋ฉด ํ•ด๋‹น ์–ด๋…ธํ…Œ์ด์…˜์ด ์œ„์น˜ํ•œ ํŒจํ‚ค์ง€๊ฐ€ ๋ฃจํŠธ ๊ฒฝ๋กœ๊ฐ€ ๋˜์–ด @Component๊ฐ€ ๋ถ™์€ ํด๋ž˜์Šค๋“ค์„ ํƒ์ƒ‰ํ•˜์—ฌ Bean์œผ๋กœ ๋“ฑ๋ก์‹œ์ผœ์ค€๋‹ค.
    • @EnableAutoConfiguration
      • ์ž๋™ ์„ค์ •์˜ ํ•ต์‹ฌ ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ, ํด๋ž˜์Šค ๊ฒฝ๋กœ์— ์ง€์ •๋œ ๋‚ด์šฉ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์„ค์ • ์ž๋™ํ™”๋ฅผ ์ˆ˜ํ–‰ํ•œ๋‹ค.
        โœ @EnableAutoConfiguration ๋‚ด๋ถ€
      • ๐Ÿ‘‰ AutoConfigurationImportSelector.class ์˜ selectImports() ๋ฉ”์†Œ๋“œ
      • ๐Ÿ‘‰ AutoConfigurationImportSelector.class ์˜ getAutoConfigurationEntry() ๋ฉ”์†Œ๋“œ
      • ๐Ÿ‘‰ AutoConfigurationImportSelector.class ์˜ getCandidateConfigurations() ๋ฉ”์†Œ๋“œ
      • ๐Ÿ‘‰ SpringFactoriesLoader.class
      • ๐Ÿ“ข SpringFactoriesLoader.class์˜ FACTORIES_RESOURCE_LOCATION ๋ณ€์ˆ˜๋ฅผ ๋ณด๋ฉด ์•Œ ์ˆ˜ ์žˆ๋“ฏ์ด, META-INF/spring.factories ํŒŒ์ผ์— ์ •์˜๋œ ์ž๋™ ์„ค์ •ํ•  ํด๋ž˜์Šค๋“ค์„ ๋จผ์ € ๋ถˆ๋Ÿฌ์™€ Bean์œผ๋กœ ๋“ฑ๋กํ•œ๋‹ค.
        • spring.factories ํŒŒ์ผ์˜ ๋ชจ๋“  ํด๋ž˜์Šค๊ฐ€ Bean์œผ๋กœ ๋“ฑ๋ก๋˜์ง€ ์•Š๊ณ , @ConditionalOnClass ์–ด๋…ธํ…Œ์ด์…˜์˜ ์˜ต์…˜์— ๋งž๋Š” ํด๋ž˜์Šค๋งŒ Bean์œผ๋กœ ๋“ฑ๋ก๋œ๋‹ค.

  • โ“๊ฐœ๋ฐœ์ž๊ฐ€ ์ •์˜ํ•œ Bean๊ณผ Spring Boot๊ฐ€ ์ •์˜ํ•œ Bean์ด ์ค‘๋ณต๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ• ๊นŒ โ“ ๐Ÿ‘‰ NO
    • getAutoConfigurationEntry()์—์„œ
      removeDuplicates() ๋ฉ”์†Œ๋“œ๋กœ ์ค‘๋ณต๋œ ์„ค์ •์„ ์ œ์™ธ์‹œํ‚ค๊ณ ,
      getExcludsions() ๋ฉ”์†Œ๋“œ๋กœ ์ œ์™ธํ•  ์„ค์ •์„ ์ œ์™ธ์‹œํ‚จ๋‹ค.

  • Spring ์‚ฌ์šฉ์‹œ, datasource๋ฅผ Bean์œผ๋กœ ๋“ฑ๋กํ•ด์ค˜์•ผ ํ•œ๋‹ค. (์˜ค๋ฅธ์ชฝ)
  • Spring Boot ์‚ฌ์šฉ์‹œ, ํ”„๋กœ์ ํŠธ์— ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋งŒ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด boot๊ฐ€ ์ถ”๊ฐ€๋œ JAR ํŒŒ์ผ์„ ์ธ์‹ํ•˜์—ฌ ๊ด€๋ จ๋œ ์Šคํ”„๋ง ์„ค์ •์„ ์ž๋™์œผ๋กœ ์ฒ˜๋ฆฌํ•ด์ค€๋‹ค
    • ๋ณต์žกํ•œ ์„ค์ • ํ•„์š”์—†์ด, ํ•„์š”์— ๋”ฐ๋ผ ์„ค์ •๊ฐ’๋งŒ ์ˆ˜์ •ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. (์™ผ์ชฝ)
  • application.yml ํŒŒ์ผ ๊ฐ’์„ ์ˆ˜์ •ํ•˜๊ฒŒ ๋˜๋ฉด
    spring-configuration-metadata.json ํŒŒ์ผ (์ปดํŒŒ์ผ ํƒ€์ž„์— ์ƒ์„ฑ๋˜๋Š” property ์ •์˜ ํŒŒ์ผ)์— ๋ฐ˜์˜๋œ๋‹ค.

๐Ÿ“ข2. starter ์˜์กด์„ฑ์„ ํ†ตํ•ด ๊ฐ„๋‹จํžˆ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค

  • โœstarter๋ž€ ์˜์กด์„ฑ๊ณผ ์„ค์ •์„ ์ž๋™ํ™”ํ•ด์ฃผ๋Š” ๋ชจ๋“ˆ์„ ์˜๋ฏธํ•œ๋‹ค.
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.3.1.RELEASE'
  • gradle์— spring-boot-starter-web ์˜์กด์„ฑ์„ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด
    • ๊ด€๋ จ ๋ชจ๋“ˆ(jar)๋“ค๋„ ํ•จ๊ป˜ ์ž๋™์œผ๋กœ classpath์— ์ถ”๊ฐ€๋œ๋‹ค.
    • classpath์— ์ถ”๊ฐ€๋œ jar ํŒŒ์ผ๋“ค์— ์˜ํ•ด spring.factories ํŒŒ์ผ์— ์žˆ๋Š” ๊ด€๋ จ ์„ค์ •์ด ์ž๋™์œผ๋กœ ์ˆ˜ํ–‰๋œ๋‹ค.

๐Ÿ“Œ ์‰ฌ์šด ์˜์กด์„ฑ ๊ด€๋ฆฌ

๐Ÿ“ข1. Spring-boot-starter

  • Spring boot Starter๋ฅผ ํ†ตํ•ด
    ์˜์กด์„ฑ๋“ค์„ ์ผ์ผ์ด ์ฐพ๊ณ , ํ˜ธํ™˜๋˜๋Š” ๋ฒ„์ „์— ๋งž์ถฐ ์˜์กด์„ฑ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฒˆ๊ฑฐ๋กœ์›€์„ ํ•ด๊ฒฐํ•˜์˜€๋‹ค.
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.3.1.RELEASE'
  • spring-boot-starter-web ์ด ํ•œ ์ค„๋งŒ ์ ์–ด์ฃผ๋ฉด
    ๐Ÿ‘‰ web๊ณผ ๊ด€๋ จ๋œ ์˜์กด์„ฑ๋“ค(spring-web, spring-webmvc , jackson-databind)์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

๐Ÿ“ข2. io.spring.dependency-management

  • Spring Boot์˜ ์˜์กด์„ฑ์„ ๊ด€๋ฆฌํ•ด์ฃผ๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ์œผ๋กœ dependency manager๊ฐ€ ๊ด€๋ฆฌํ•˜๋Š” ํ”„๋กœ์ ํŠธ๋“ค์€ ์•Œ์•„์„œ ๋ฒ„์ „๊ด€๋ฆฌ๋ฅผ ํ•ด์ค€๋‹ค.
    ๐Ÿ‘‰ build ์„ค์ •์— dependency์— ๋Œ€ํ•œ ๋ฒ„์ „์„ ๋ช…์‹œํ•  ํ•„์š”๊ฐ€ ์—†๊ฒŒ๋œ๋‹ค.
    (์ง์ ‘ ๋ฒ„์ „์„ ๋ช…์‹œํ•˜๋Š” ๊ฒฝ์šฐ ํ•ด๋‹น ๋ฒ„์ „์œผ๋กœ ์˜ค๋ฒ„๋ผ์ด๋”ฉ๋œ๋‹ค)
    ๐Ÿ‘‰ ๋‹จ ํ•œ์ค„์˜ ์˜์กด์„ฑ์œผ๋กœ ์ˆ˜ ๋งŽ์€ ํ”„๋กœ์ ํŠธ๋“ค์˜ ๋ฒ„์ „์„ ์ถฉ๋Œ ์—†์ด ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒŒ๋œ๋‹ค.

๐Ÿ“Œ ๋‚ด์žฅ Servlet ์ปจํ…Œ์ด๋„ˆ ์ง€์› (๋‚ด์žฅ ์„œ๋ฒ„ ์ง€์›)

๐Ÿ“ข1. Spring์„ ์ด์šฉํ•œ ํ”„๋กœ์ ํŠธ ๋ฐฐํฌ

๐Ÿ‘‰ war(Web application ARchive) ํŒŒ์ผ (์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์••์ถ•๋œ ํŒŒ์ผ)๊ณผ WAS (ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰์‹œํ‚ฌ ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„)๊ฐ€ ํ•„์š”

๐Ÿ“ข2. Spring Boot๋ฅผ ์ด์šฉํ•œ ํ”„๋กœ์ ํŠธ ๋ฐฐํฌ

๐Ÿ‘‰ Tomcat์ด๋‚˜ Jetty๊ฐ™์€ ๋‚ด์žฅ ์„œ๋ฒ„๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— jar ํŒŒ์ผ๋งŒ์œผ๋กœ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ๋‹ค.

  • Servlet Container์— ์ข…์†๋˜๋˜ WebApplication์ด WebApplication์— Servlet Container์ด ์ข…์†ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋จ
  • war, jar๋ฅผ ์„ ํƒํ•˜์—ฌ ๋ฐฐํฌ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.
  • WAS๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค. (Tomcat, Jetty, Undertow)

๐Ÿ“Œ ๋ชจ๋‹ˆํ„ฐ๋ง (Actuator)

  • Spring Boot Actuator๋ž€ Spring Boot Application์˜ ์ƒํƒœ ์ •๋ณด(health, properties, beans, ๊ตฌ๋™๋œ AutoConfiguration ๋ชฉ๋ก ๋“ฑ)๋ฅผ ๋‹ค๋ฃจ๋Š” Spring Boot์˜ ์ž์ฒด์ ์ธ ๊ธฐ๋Šฅ์ด๋‹ค.
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
}

๐Ÿ“ข Endpoint

{
   "_links":{
      "self":{"href":"http://localhost:8080/actuator"},
      "auditevents":{"href":"http://localhost:8080/actuator/auditevents"},
      "beans":{"href":"http://localhost:8080/actuator/beans"},
      "health":{"href":"http://localhost:8080/actuator/health"},
      "conditions":{"href":"http://localhost:8080/actuator/conditions"},
      "configprops":{"href":"http://localhost:8080/actuator/configprops"},
      "env":{"href":"http://localhost:8080/actuator/env"},
      "env-toMatch":{"href":"http://localhost:8080/actuator/env/{toMatch}"},
      "info":{"href":"http://localhost:8080/actuator/info"},
      "loggers":{"href":"http://localhost:8080/actuator/loggers"},
      "loggers-name":{"href":"http://localhost:8080/actuator/loggers/{name}"},
      "heapdump":{"href":"http://localhost:8080/actuator/heapdump"},
      "threaddump":{"href":"http://localhost:8080/actuator/threaddump"},
      "metrics-requiredMetricName":{"href":"http://localhost:8080/actuator/metrics/{requiredMetricName}"},
      "metrics":{"href":"http://localhost:8080/actuator/metrics"},
      "scheduledtasks":{"href":"http://localhost:8080/actuator/scheduledtasks"},
      "httptrace":{"href":"http://localhost:8080/actuator/httptrace"},
      "mappings":{"href":"http://localhost:8080/actuator/mappings"},
      "jolokia":{"href":"http://localhost:8080/actuator/jolokia"}
   }
}

๐Ÿ“ข ์ฃผ์˜ํ•  ์ 

  1. actuator๋Š” ๋ฏผ๊ฐํ•œ ์ •๋ณด๋„ ๋งŽ์ด ์ œ๊ณตํ•ด์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ์šด์˜ ์‹œ์—๋Š” Spring Security ๋“ฑ์„ ์ด์šฉํ•˜์—ฌ ๋ณด์•ˆ์— ์‹ ๊ฒฝ์จ์•ผํ•œ๋‹ค.
  2. WAS๋ฅผ ์žฌ์‹œ์ž‘ํ•˜๋ฉด actuator์˜ ์ด์ „ ๋ฐ์ดํ„ฐ๊ฐ€ ์‚ฌ๋ผ์ง„๋‹ค.

0๊ฐœ์˜ ๋Œ“๊ธ€