mysap
mysap

Reputation: 297

Difference between Springboot 1.X and Springboot 2.0

We have been using Springboot 1.X for our applications. Now were are getting ready to start on a few new applications and was wondering if we should go with SpringBoot2.0 or stick with SpringBoot 1.X?

Any thoughts on one version or the other?

Also, what are the differences between Spring Boot 1.X vs Spring Boot 2.0?

Thanks.

Upvotes: 25

Views: 29159

Answers (4)

Min Hyoung Hong
Min Hyoung Hong

Reputation: 1202

You can find differences and migration guide here : https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide

  • Java 8 is base version
  • properties changed
  • spring.jackson.serialization.write-dates-as-timestamps=true is default value
  • Spring Security configuration become easier
  • Spring Security Oauth2 merges into Spring Security
  • Better dependency management

Upvotes: 26

Rose
Rose

Reputation: 696

You can follow this: https://www.baeldung.com/new-spring-boot-2

  1. Spring Boot 2.x is the first version to support Java 9.

  2. In 2.x by default, everything is secured, including static resources and Actuator endpoints.

  3. In Spring Boot 1.x only Spring-MVC was supported for actuator endpoints. In 2.x, however, it became independent and pluggable.

  4. In 2.x when our application gets restarted by devtools a ‘delta' report will be printed out.

  5. Tomcat minimum supported version is 8.5

  6. Hibernate minimum supported version is 5.2

  7. Gradle minimum supported version is 3.4

Upvotes: 1

Upendra Joshi
Upendra Joshi

Reputation: 19

most of the things are getting autoconfigured in 2x from component Scan to auto table creation to the db connected

Upvotes: 1

Putti
Putti

Reputation: 341

SpringBoot 2.* Changes:

1.Java 8 is minimum version

2.Tomcat version 8.5 is minimum

3.Hibernate version 5.2 is minimum

4.Gradle version 3.4 is minimum

5.Added SpringBoot Starters for WebFlux and reactive support for Cassandra, MongoDB and Redis.

6.AutoConfiguration

a.Security (Need to add a bean to expose actuator endpoints like health etc)

Sample Code: (Modify below code based on your needs)

@Configuration
public class ApplicationSecurity extends WebSecurityConfigurerAdapter {

  @Override
  public void configure(WebSecurity web) throws Exception {
     web
        .ignoring()
            .antMatchers("/**");
     }
  }

b.Need to add spring-boot-starter-security dependency:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
  1. Actuator Endpoint change:

    Before 2.*: http://localhost:8080/business-customer/profile/env will give the details.

    From 2.*: http://localhost:8080/business-customer/profile/actuator/env will give the details.

  2. Endpoint properties in application.properties (to enable all endpoints)

    management.endpoints.web.exposure.include=* management.endpoints.web.exposure.exclude=loggers

  3. Connection Pool by default:

    Before 2.*: tomcat CP

    After 2.: HikariCP (from SpringBoot 2. You don't need to add HikariCP dependency and its config bean creation and its properties changes.)

  4. Migration: https://spring.io/blog/2018/03/12/upgrading-start-spring-io-to-spring-boot-2

Upvotes: 23

Related Questions