[Spring] Spring Architecture

DYKOยท2022๋…„ 9์›” 3์ผ
0

Spring Framework

๋ชฉ๋ก ๋ณด๊ธฐ
2/7
post-thumbnail

Srping ํ”„๋ ˆ์ž„์›Œํฌ๋Š” 20์—ฌ๊ฐœ์˜ ๋ชจ๋“ˆ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค. ํ•ด๋‹น ๋ชจ๋“ˆ๋“ค์€ ์œ„์˜ 'Overview of Spring Framework' ๋‹ค์ด์–ด๊ทธ๋žจ์—์„œ ๋ณด๋Š” ๊ฒƒ๊ณผ ๊ฐ™์ด Data Access/Integration, Web, AOP, Core Container, Instrumentation, Test๋กœ ๊ทธ๋ฃนํ™”๋œ๋‹ค.

๐Ÿ’ก Core Container

Core Container๋Š” Core, Beans, Context, spEL๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค.

  • Core
    Spring ํ”„๋ ˆ์ž„์›Œํฌ์˜ ๊ธฐ๋ณธ ๋ถ€๋ถ„์„ ์ œ๊ณตํ•˜๋ฉฐ, Spring์˜ ๋ชจ๋“  ๊ธฐ๋Šฅ๋“ค์€ Core ๋ชจ๋“ˆ์˜ ์ธํ„ฐํŽ˜์ด์Šค์™€ ํด๋ž˜์Šค๋ฅผ ๊ตฌํ˜„/์ƒ์†๋ฐ›์Œ
  • Beans
    ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š” Bean ์˜ค๋ธŒ์ ํŠธ์™€ BeanFactory๋ฅผ ์ œ๊ณตํ•˜๋Š” ๋ชจ๋“ˆ๋กœ, IoC/DI ๊ธฐ๋Šฅ์„ ์ œ๊ณต
  • Context
    Core์™€ Beans ๋ชจ๋“ˆ์˜ ๊ธฐ๋Šฅ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋‚ด ์ •์˜ ๋ฐ ๊ตฌ์„ฑ๋œ ๋ชจ๋“  ๊ฐœ์ฒด์— ์ ‘๊ทผํ•˜๊ณ  ์ œ์–ดํ•˜๋Š” ์ž‘์—…์„ ๋‹ด๋‹น, BeanFactory๋ฅผ ์ƒ์†ํ•˜๋Š” ApplicationContext ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ Context ๋ชจ๋“ˆ์˜ ์ค‘์ ์ž„
  • Expression Language(SpEL)
    runtime ์‹œ Bean ๊ฐ์ฒด๋ฅผ ์กฐํšŒํ•˜๊ณ  ์กฐ์ž‘ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณต, ์–ธ์–ด๊ตฌ๋ฌธ์€ Unified EL๊ณผ ๋น„์Šทํ•˜์ง€๋งŒ ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ ๋ฐ ๊ธฐ๋ณธ ๋ฌธ์ œ์—ด ํ…œํ”Œ๋ฆฟ ๊ธฐ๋Šฅ ๋“ฑ ์ถ”๊ฐ€์ ์ธ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•จ

๐Ÿ’ก Data Access/Integration

Data Access/Integration ๊ณ„์ธต์—๋Š” JDBC, ORM, OXM, JMS, Transaction ๋ชจ๋“ˆ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค.

  • JDBC(Java Database Connectivity)
    JDBC ๊ด€๋ จ ์ฝ”๋”ฉ์˜ ํ•„์š”์„ฑ์„ ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ๋„๋ก JDBC ์ถ”์ƒํ™”๋ฅผ ์ œ๊ณต
  • ORM(Object Relational Mapping)
    JPA, JDO, Hibernate ๋ฐ iBatis ๋“ฑ ๊ฐ์ฒด ๊ด€๊ณ„ํ˜• ๋งคํ•‘ API์— ๋Œ€ํ•œ ํ†ตํ•ฉ ๋ ˆ์ด์–ด ์ œ๊ณต
  • OXM(Object XML Mapping)
    JAXB, Castor, XMLBeans, JiBX, XStream ๋“ฑ์˜ Object/XML ๋งคํ•‘์„ ์ง€์›ํ•˜๋Š” ์ถ”์ƒํ™” ๊ณ„์ธต์„ ์ง€์›
  • JMS(Java Message Service)
    ๋ฉ”์„ธ์ง€ ์ƒ์„ฑ ๋ฐ ์†Œ๋น„๋ฅผ ์œ„ํ•œ ๊ธฐ๋Šฅ ์ œ๊ณต
  • Transaction
    POJO ํ”„๋กœ๊ทธ๋ž˜๋ฐ๊ณผ ํŠน์ˆ˜ํ•œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•œ ํด๋ž˜์Šค๋ฅผ ์œ„ํ•ด Programmatic/Declarative transaction management ๊ธฐ๋Šฅ์„ ์ง€์›
    • Programmatic transaction management
      ์•„๋ž˜์™€ ๊ฐ™์ด ํŠธ๋žœ์žญ์…˜ ๊ด€๋ฆฌ๋ฅผ ๊ฐœ๋ฐœ์ž๊ฐ€ ์ง์ ‘ ์ฝ”๋“œ๋กœ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์œผ๋กœ, ํŠธ๋žœ์žญ์…˜ ์ˆ˜๊ฐ€ ์ ์„ ๋•Œ ์ ํ•ฉํ•œ ๋ฐฉ์‹์ด๋‹ค.

    • Declarative transaction management
      ์„ ์–ธ์  ํŠธ๋žœ์žญ์…˜ ๊ด€๋ฆฌ๋ผ๊ณ  ํ•˜๋ฉฐ @Tranaction ์–ด๋…ธํ…Œ์ด์…˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ ์–ธํ•œ๋‹ค. ํŠธ๋žœ์žญ์…˜ ์ˆ˜๊ฐ€ ๋งŽ์„ ๋•Œ ์ ํ•ฉํ•˜๋ฉฐ, AOP๋ฅผ ํ†ตํ•ด ๊ด€๋ฆฌ๋˜์–ด ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง๊ณผ ํŠธ๋žœ์žญ์…˜ ๊ด€๋ฆฌ ์ฝ”๋“œ๋ฅผ ๋ถ„๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค.

      ์ด๋ฏธ์ง€ ์ถœ์ฒ˜ : Spring Transaction Propagation

๐Ÿ’ก Web

Web ๊ณ„์ธต์€ Web, Servlet, Portlet, WebSocket ๋ชจ๋“ˆ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋‹ค. (Web-Struts ๋ชจ๋“ˆ๋„ ์ง€์›ํ–ˆ์œผ๋‚˜ Spring 3.0๋ถ€ํ„ฐ๋Š” ์ œ์™ธ๋๋‹ค.)

  • Web
    multipart file-upload, ์„œ๋ธ”๋ฆฟ ๋ฆฌ์Šค๋„ˆ์™€ WebApplicationContext๋ฅผ ํ†ตํ•œ IoC ์ปจํ…Œ์ด๋„ˆ ์ดˆ๊ธฐํ™” ๊ฐ™์€ ๊ธฐ๋ณธ์ ์ธ ์›น ์ง€ํ–ฅ ํ†ตํ•ฉ ๊ธฐ๋Šฅ์„ ์ œ๊ณต, ์›น๊ณผ ๊ด€๋ จ๋œ Spring์˜ ์›๊ฒฉ ์ง€์› ๊ธฐ๋Šฅ์ด ํฌํ•จ๋จ.

    multipart file-upload: MultipartFile ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ด์šฉํ•˜์—ฌ ํฐ ํŒŒ์ผ์„ ์ฒญํฌ ๋‹จ์œ„๋กœ ์ชผ๊ฐœ์„œ ํšจ์œจ์ ์œผ๋กœ ํŒŒ์ผ์„ ์—…๋กœ๋“œํ•˜๋Š” ๊ธฐ๋Šฅ
    servlet listner: ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์ฃผ์š” ์ด๋ฒคํŠธ๋ฅผ ๊ฐ์ง€ํ•˜๊ณ , ๊ฐ ์ด๋ฒคํŠธ์— ํŠน๋ณ„ํ•œ ์ž‘์—…์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ์— ์‚ฌ์šฉ

  • Servlet
    ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ model-view-controller(MVC) ๊ธฐ๋Šฅ์ด ๊ตฌํ˜„๋œ ๋ชจ๋“ˆ๋กœ spring-webmvc ๋ชจ๋“ˆ๊ณผ ๋™์ผ. ๋„๋ฉ”์ธ ๋ชจ๋ธ ์ฝ”๋“œ์™€ ์›น ์–‘์‹์„ ๊น”๋”ํ•˜๊ฒŒ ๋ถ„๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ์ง€์›ํ•จ
  • Portlet
    ํฌํ‹€๋ฆฟ(Portlet: ์žฌ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•œ ์›น ์ปดํฌ๋„ŒํŠธ๋กœ ์š”์ฒญ์˜ ์ฒ˜๋ฆฌ ๋ฐ ๋™์  ์ปจํ…์ธ ๋ฅผ ์ฒ˜๋ฆฌ) ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉํ•  MVC ๊ตฌํ˜„์„ ์ œ๊ณตํ•˜๊ณ  Web-Servlet ๋ชจ๋“ˆ์˜ ๊ธฐ๋Šฅ์„ ๋ฏธ๋Ÿฌ๋งํ•จ
  • WebSocket
    Spring 4.0๋ถ€ํ„ฐ ๋„์ž…๋œ ๋ชจ๋“ˆ๋กœ, ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ ๊ฐ„์— ํ†ต์‹  ์‹œ ํ•œ ๋ฒˆ ํ†ต์‹ ์„ ํ•˜๋ฉด ๊ณ„์† ์œ ์ง€๋˜๋Š” ๋™์‹œ์— ์–‘๋ฐฉํ–ฅ ํ†ต์‹ ์„ ํ•  ์ˆ˜ ์žˆ๋Š” ์›น์†Œ์ผ“ ๊ธฐ๋Šฅ์„ ์ œ๊ณต

    Spring 3.0๋ถ€ํ„ฐ Web ๊ณ„์ธต์—์„œ ์‚ฌ๋ผ์ง„ ๋ชจ๋“ˆ

    • Web-Struts
      Spring ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋‚ด์—์„œ ์ „ํ†ต์ ์ธ Structs ์›น ๊ณ„์ธต์„ ํ†ตํ•ฉํ•˜๊ธฐ ์œ„ํ•œ ํด๋ž˜์Šค๋ฅผ ์ง€์›ํ–ˆ์œผ๋‚˜, Spring 3.0๋ถ€ํ„ฐ๋Š” ์‚ฌ์šฉ๋˜์ง€ ์•Š๊ณ  Struts 2.0์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ Spring MVC ์†”๋ฃจ์…˜์œผ๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ํ•  ๊ฒƒ์„ ๊ถŒ์žฅํ•จ.
    • Struts: ์•„ํŒŒ์น˜ ํ”„๋กœ์ ํŠธ์˜ ์ผ๋ถ€๋กœ ์ง„ํ–‰๋˜๊ณ  ์žˆ๋Š” MVC๋ชจ๋ธ์— ๊ธฐ๋ฐ˜ํ•œ ์›น ํ”„๋ ˆ์ž„์›Œํฌ, Java EE ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ•˜๊ธฐ ์œ„ํ•œ ์˜คํ”ˆ ์†Œ์Šค ํ”„๋ ˆ์ž„์›Œํฌ์ด๋‹ค.

๐Ÿ’ก ๊ธฐํƒ€ ๋ชจ๋“ˆ

  • AOP
    AOP ๋ชจ๋“ˆ์„ ํ†ตํ•ด ๊ด€์  ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์ง€์›
  • Instrumentation
    ํŠน์ • ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„์—์„œ ์‚ฌ์šฉํ•  ํด๋ž˜์Šค ๊ณ„์ธก ๋ฐ ํด๋ž˜์Šค ๋กœ๋” ๊ธฐ๋Šฅ์„ ์ œ๊ณต
  • Messaging
    ๋ฉ”์‹œ์ง• ๊ธฐ๋ฐ˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ธฐ๋ฐ˜์ด ๋˜๋Š” ์ฃผ์š” ๊ธฐ๋Šฅ๋“ค์„ ์ œ๊ณตํ•จ. ์›น์†Œ์ผ“ ํ•˜์œ„ ํ”„๋กœํ† ์ฝœ๋กœ STOMP๋ฅผ ์ง€์›ํ•˜๋ฉฐ, ์›น์†Œ์ผ“ ํด๋ผ์ด์–ธํŠธ์—์„œ STOMP ๋ฉ”์‹œ์ง€๋ฅผ ๋ผ์šฐํŒ…ํ•˜๊ณ  ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์–ด๋…ธํ…Œ์ด์…˜ ๊ธฐ๋Šฅ์„ ํฌํ•จํ•จ
  • Aspects
    AOP ํ”„๋ ˆ์ž„์›Œํฌ์ธ AspectJ์™€์˜ ํ†ตํ•ฉ ๊ธฐ๋Šฅ์„ ์ œ๊ณต
  • Test
    JUnit, TestNG ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์ด์šฉํ•ด Spring ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ๋„๋ก Test ๋ชจ๋“ˆ ์ง€์›

๐Ÿ’ก Spring ๋ชจ๋“ˆ๊ฐ„ ๊ด€๊ณ„๋„



์ฐธ๊ณ  ๋ฌธํ—Œ ๋ฐ ์‚ฌ์ดํŠธ

Introduction to Spring Framework - docs.spring.io
[tutorialspoint] Spring Framework - Architecture
[Spring]์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ์˜ ์ฃผ์š” ๋ชจ๋“ˆ๋“ค์„ ์•Œ์•„๋ณด์ž - outstanding
Spring Transaction Propagation
Struts 1: ์ŠคํŠธ๋Ÿฌ์ธ ๋ž€ ๋ฌด์—‡์ธ๊ฐ€ - ์žฅ์Šค
[Spring]์ฃผ์š” ๋ชจ๋“ˆ ๊ตฌ์„ฑ - ๋Šฅ๊ตฌ์™€ ํ† ๊นฝ์ด

profile
์—”์ง€๋‹ˆ์–ด๊ฐ€ ๋˜๋Š” ๊ทธ ๋‚  ๊นŒ์ง€!

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