코드굽는 타자기

Spring Boot vs. Spring MVC vs. Spring 본문

Spring

Spring Boot vs. Spring MVC vs. Spring

bright-jun 2022. 4. 22. 14:47

https://dzone.com/articles/spring-boot-vs-spring-mvc-vs-spring-how-do-they-compare

Spring Framework 가 해결해 주는 문제

  1. DI or IOC
  2. Duplication/Plumbing Code
    • Reduce Boilerplate Code/Reduce Duplication
    • Promote Decoupling/Increase Unit Testability
      • Spring JDBC
      • Spring MVC
      • Spring AOP
      • Spring ORM
      • Spring JMS
      • Spring Test
  3. Good Integration With Other Frameworks
    • Hibernate for ORM
    • iBatis for Object Mapping
    • JUnit and Mockito for Unit Testing

Spring MVC Framework 가 해결해 주는 문제

Spring MVC Framework provides decoupled way of developing web applications. With simple concepts like Dispatcher Servlet, ModelAndView and View Resolver, it makes it easy to develop web applications.

Spring Boot 가 해결해 주는 문제

Spring based applications have a lot of configuration.

  • When we use Spring MVC, we need to configure component scan, dispatcher servlet, a view resolver, web jars(for delivering static content) among other things.
  • When we use Hibernate/JPA, we would need to configure a datasource, an entity manager factory, a transaction manager among a host of other things.
  1. @AutoConfiguration
    • Spring Boot Auto Configuration: Can We Think Different?
      • How about auto-configuring a Data Source if Hibernate jar is on the classpath?
      • How about auto-configuring a Dispatcher Servlet if Spring MVC jar is on the classpath?
    • Spring Boot looks at
      • Frameworks available on the CLASSPATH
      • Existing configuration for the application.
      • Based on these, Spring Boot provides basic configuration needed to configure the application with these frameworks.
      • This is called @AutoConfiguration.
  2. Spring Boot Starter Projects: Built Around Well-Known Patterns

Dependency for Spring Boot Starter Web

  • Here’s what the Spring Boot documentations says about starters.

Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy paste loads of dependency descriptors.
For example, if you want to get started using Spring and JPA for database access, just include the spring-boot-starter-data-jpa dependency in your project, and you are good to go.

Spring Boot Starter Project Options

  • spring-boot-starter-web-services: SOAP Web Services
  • spring-boot-starter-web: Web and RESTful applications
  • spring-boot-starter-test: Unit testing and Integration Testing
  • spring-boot-starter-jdbc: Traditional JDBC
  • spring-boot-starter-hateoas: Add HATEOAS features to your services
  • spring-boot-starter-security: Authentication and Authorization using Spring Security
  • spring-boot-starter-data-jpa: Spring Data JPA with Hibernate
  • spring-boot-starter-cache: Enabling Spring Framework’s caching support
  • spring-boot-starter-data-rest: Expose Simple REST Services using Spring Data REST

Other Goals of Spring Boot

  • There are a few starters for technical stuff as well
    • spring-boot-starter-actuator: To use advanced features like monitoring and tracing to your application out of the box
    • spring-boot-starter-undertow, spring-boot-starter-jetty, spring-boot-starter-tomcat: To pick your specific choice of Embedded Servlet Container
    • spring-boot-starter-logging: For Logging using logback
    • spring-boot-starter-log4j2: Logging using Log4j2
  • Spring Boot aims to enable production ready applications in quick time.
    • Actuator: Enables Advanced Monitoring and Tracing of applications.
    • Embedded Server Integrations: Since the server is integrated into the application, I would need to have a separate application server installed on the server.
    • Default Error Handling

'Spring' 카테고리의 다른 글

Static Class vs Bean  (0) 2022.05.09
DBCP(DB Connection pool)이란?  (0) 2022.05.09
싱글톤(Singleton) 패턴  (0) 2022.05.09
web QueryParameter vs PathVariable  (0) 2022.05.06
gradle 사용시 lombok cannot find symbol 에러  (0) 2022.05.06
Comments