Developing Web Application using SpringMVC and JPA (Non Spring Boot Way )
- Configure Maven Dependencies in pom.xml
- Configure Service/DAO layer beans using Java Config
- Can configure DataSource, DataSourceInitializer, JPA Repo, Property Source etc
- Configure Spring MVC web layer beans
- Configure Thyleaf , ViewResolver, ResouceHandler, MessageSource etc
- Register AppConfig.class and WebMvcConfig.class and with AbstractAnnotationConfigDispatcherServletInitializer
- Create a JPA Entity and Spring Data JPA Repository
- Create a SpringMVC Controller
- Create a thymeleaf view /WEB-INF/views/index.html to render list of BaseEntities
Developing Web Application using SpringBoot
- Create a Maven based SpringBoot Project
- Configure datasource/JPA properties in application.properties
- Straight away jump to creating Entity , EntityRepo & Controller
- Create Thyleaf view
- Create Spring Boot entry point.
Spring Boot lets the developer focus on the application’s development first, and removes the need to be overly concerned with every other aspect of its lifecycle, including deployment and management
It is easy to create stand-alone, production-grade Spring based
Applications that you can ‘just run’”. It supports “convention over configuration”.
Bill Of Material : BOM
Spring Boot calls its 'intelligent collection of dependencies' as BOM
Spring Developers have taken the time to match all the correct versions that work well with each other.
For Example : if you are using 'spring-core 4.2.3' then it works well with 'logback-core 1.1.3'. If you keep including dependencies manually then you may have to spend a fair amount of time. Thanks to Spring boot (Maven) all of this is gone.
Note in traditional Spring boot app you use
but in Spring boot you use
Reason being... Spring boot starter parent at start or pom takes care of it
You can change it as you want and the effective pom will change accordingly.
- Easy Dependency Management
- Pulls in dependency like springboot-starter-web dependency by default it will pull all the commonly used libraries while developing Spring MVC applications such as spring-webmvc, jackson-json, validation-api and tomcat.
- Similarly can see Spring-boot-starter-data-jpa dependency
- Auto Configuration
- Thanks to @Conditional
- Embedded Server
- spring-boot-starter-web which pull the spring-boot-starter-tomcat automatically
- Actuators
- Dev Tools
Bill Of Material : BOM
Spring Boot calls its 'intelligent collection of dependencies' as BOM
Spring Developers have taken the time to match all the correct versions that work well with each other.
For Example : if you are using 'spring-core 4.2.3' then it works well with 'logback-core 1.1.3'. If you keep including dependencies manually then you may have to spend a fair amount of time. Thanks to Spring boot (Maven) all of this is gone.
Note in traditional Spring boot app you use
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.2.4.RELEASE</version> </dependency>
but in Spring boot you use
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
Reason being... Spring boot starter parent at start or pom takes care of it
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.1.RELEASE</version> </parent>
You can change it as you want and the effective pom will change accordingly.
No comments:
Post a Comment