Spring Boot - mrbmrb1122/SpringBootCloud GitHub Wiki
Solves the amount of configuration that is needed. Wirh Spring and Spring MVC we need to configure data sources, view Resolvers, web Jars and variety of stuff SpringBoot says Ok i will look at the what are the jars available in class path, i will configure everything immediately. In addition to this Spring boot provides a lot of non-functional features like helping the monitoring of the applications very very easy.
Auto Configuration is a feature of spring boot where it looks at the frameworks/jars available in the class path and looks at the existing configuration for the application and decides what configuration is needed and what can be automatically be configured. If it sees JPA jar inthe class path, it will automatically configures entity manager, it automatically configures data sources. If it sees Spring MVC, it would automatically configures a dispatcher servlet and automatically configures error page, error response.
Whenever we develop normal projects with Spring or Spring MVC or Hibernate, we would need to add a lot of dependecies and need manage their versions and also we need to configure lots of stuff. SpringBoot starter projects help us in avoiding all these configs and all. If we add in simple startup projects like spring-boot-starter-web in pom.xml, it will brings lots of jars and along with it would bring all the spring related jars like All related MVC jars,Jackson jars for Json bindings, it brings in validation Jars, most important is Embedded servlet container like tomcat
- Spring-boot-starter-web-services--> SOAP Web Services
- Spring-boot-starter-web --> Web & Restful Applications
- Spring-boot-starter-test --> Unit testing and Integration testing.
- Spring-boot-starter-jdbc --> Traditional JDBC
- Spring-boot-starter-heteoas--> Add Hateoas features to your services
- Spring-boot-starter-security --> Authentication and Authorization using Spring security
- Spring-boot-starter-jpa --> Spring Data JPA with hibernate
- Spring-boot-starter-data-rest --> Expose Simple REST Services using Spring Data REST
Main aim of spring boot is to readuce configuration stuff as we discussed before like Auto configuration, Starter projects. And also enabls the production ready environment. Spring Boot provides a few non functional features out of the box, like caching, logging, Monitoring and embedded servers. Spring-boot-starter-actuator --> to use advanced features like monitoring & tracing to your application. Spring-boot-starter-undertow, Spring-boot-starter-jetty, Spring-boot-starter-tomcat --> to pick our choice of embeeded server containers. Spring-boot-starter-logging --> FOr logging using logback. Spring-boot-starter-cache--> Enable Spring Framework's Caching support.
go to Http://start.spring.io is great tool to bootstrap our SpringBoot project.
SpringBoot 2 requires Java 8 or later. Java 6 and 7 are no longer supported.
Use SpringBoot developer tools.
If we want to deploy application, we need servers. Its very easy to deploy stuff
Spring Data is one of the project under the umbrella of SpringBoot. Is to Provide a familiar a simple abstratction to be able to talk to multiple kinds of databases there are a wide variety of databases like relational, non-relations, Map-Reduce, cloud based the aim is to provide one way to access all these data bases. And there is a specific thing in the Spring Data called Spring Data JPA which is used to provide a simple approach to creating a JPA repositories.
Whenever we create a JPA, we need to create duplicate data, JPA you dont really need to do all that. If you crteate a simple interface , it would provide all the basic methods todo the CRUD operations.
Spring Data Rest is one the API which built on top of spring data JPA and we can expose Hateoas restful services.
TO maintain config files depending up on region/environment.
QA, DEV, Stage, PROD config files. We will set environment variable like
we will create environemnt spefic profiles and also we will
use -Dspring.profiles.active=PROD in VM arguments.
use spring.profiles.active=PROD in application.properties