Thursday 24 January 2019

// // Leave a Comment

Spring Boot 2

Spring Boot 2!!!

         - Made Developer Life Easier 


As typical definition says Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".

Let me elaborate Top 5 Features on 2.x Upgrade.

1.Simplified Security 
2.HTTP/2 Support
3.Quartz Scheduler
4.HikariCP Connection Pool
5.Developer Tools

1.Simplified Security 

How about using custom security in a simple and easy way!!! Yes it does

By default, everything is secured, including static resources and Actuator endpoints. If Spring Security is on the classpath, Spring Boot will add @EnableWebSecurity and rely on Spring Security’s content-negoation to decide which authentication mechanism to use. 

Example 

http
    .authorizeRequests()
        //If your /Foo and /Foo1 endpoints do not require authentication just
        .requestMatchers(EndpointRequest.to("Foo", "Foo1"))
            .permitAll()

//If our actuator endpoints to be protected by the ACTUATOR role then
        .requestMatchers(EndpointRequest.toAnyEndpoint())
            .hasRole("ACTUATOR")

.// If static resource locations needs to be open to all
        .requestMatchers(StaticResourceRequest.toCommonLocations())
            .permitAll()

//If our application endpoints are protected by the USER role
        .antMatchers("/**")
            .hasRole("USER")

etc


2.HTTP/2 Support


1996 Traditional http/1 was launched now web changed the world to support http/2 just add

server.http2.enabled=true


3.Quartz Scheduler


Quartzis a richly featured, open source job schedulinglibrary that can be integrated within virtually any Java application - from the smallest stand-alone application to the largest e-commerce system.

Starter Dependency can be added Both in-memory and JDBC stores can be configuredby this way

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>


4.HikariCP Connection Pool


The default connection pool has switched from Tomcat to HikariCP. If you used spring.datasource.type to force the use of Hikari in a Tomcat-based application, you can now remove that override. Similarly, if you want to stay with the Tomcat connection pool, simply add the following to your configuration
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource

5.Developer Tools

The Default configuration when application restarts, a report showing the condition evaluation delta is logged.
To disable that logging of report add to configuration

spring.devtools.restart.log-condition-evaluation-delta=false



Thanks for Reading!!!!

Please do comment for queries :)

0 comments:

Post a Comment