Spring Boot :
-------------------
- Spring boot is one of the module in Spring Framework.
- The main intensive/objective of the Spring Boot is to make spring application development easier.
- create maven web app project.
- Add dependencies from required spring module.
- Spring-core
- Spring - Context
- Spring - web mvc
- spring - web
- Spring JDBC
- Spring ORM
- Spring JPA
- Javax Validation
- For ex - Spring 4.x ------ Hibernate 4.x , if we get ClassNotFoundException --
It is very difficult to developer to identify exact versions of jars and their
dependencies in maven.
3. Configure web.xml
4. Configure Dispatcher-servlet.xml
-> View Resolver.
-> Resources
--> Default Servlet Handler.
--> Default Servlet Handler.
--> Component Scan for controller.
5. Root Context for Specific Spring Configuration.
6. Controllers
@Controller or @RestController or extends Controller.
Note : To develop any web application in spring, 1 to 5 steps will be same .
--> application to application business logic will be changed.
There are some drawbacks in spring, and using spring framework, we can overcome those drawbacks.
Complexities in Spring Framework :-
Complexities in Spring Framework :-
- Lot of Manual configuration is required. --- XML or java config or Autowired.
- Dependency Management is too hard. -- Adding manual jars and their dependencies.
- Difficult for new comers to try out spring features --
They understand how to configure beans what are the jars they are using.
Lot of Manual Configuration :
- Make J2EE Application Development is easier.
- Dependency Injection
- Aspect Oriented Programming
- All these needs some manual configurations
- Bean declaration
- Dispatcher Servlet
- DatsSource etc..
We need to configure these in xml based or java config base.
- Lighter in terms of code, but heavy weight with configuration.
- Effort to make easier
- Started with XML
- Java Configuration and Annotations.
- Autowired and Component Scan.
Dependency Management is Too Hard
To develop any web application spring needs several frameworks and libraries.
- JSTL..
- Thymeleaf.
- Hibernate.
- Validator and Implementation.
--> Spring itself split into many jars.
--> Combinations of dependency version.
------------------>" Spring Boot was create to address all above complexities Spring Boot is not replacement of Spring Framework ---------------->>>>
Spring Boot Features
- Automatic Configuration.
- Spring Boot will take care, how to configure the beans using annotations.
- Easy Dependency Management - Spring Boot will be taking care.
- Starter pom or parent pom -- 100
- Starter dependency - webmvc / dao / orm
- CLI tool for quick prototyping
- It will be used to implement POC.
- Opinionated but highly customizable.
- Embeded Server
- Traditional Applications develop the code and deploy the code into server.
- Using Boot, Develop the code and code will start the server. Server is a part of application
- Spring applications without XML configuration
- Spring Boot actuator for monitoring metrics.
For eg :
Advantages of Embedded Server :
------------------------------------------
- Non Embeded Server
- Install the server.
- Configure the server with exact configurations as old server.
- Deploy the application into new server.
- Embeded Server :
- Copy the application into any system and just run the application.
Enable Auto configurations
Whenever SpringApplication.run(Application.class, args) ---> runs it will create one container.
D:\practice\curl-7.61.1-win64-mingw>dir
Volume in drive D is DATA
Volume Serial Number is AE01-28AB
Directory of D:\practice\curl-7.61.1-win64-mingw
09/07/2018 09:48 PM <DIR> .
09/07/2018 09:48 PM <DIR> ..
09/07/2018 09:47 PM <DIR> bin
09/05/2018 05:48 AM 62 BUILD-HOMEPAGE.url
09/05/2018 05:48 AM 123 BUILD-README.txt
09/05/2018 05:48 AM 212,264 CHANGES.txt
06/27/2018 03:03 PM 1,103 COPYING-brotli.txt
08/30/2014 10:41 PM 1,928 COPYING-libssh2.txt
09/02/2018 06:52 AM 1,179 COPYING-nghttp2.txt
01/15/2017 05:29 PM 5,302 COPYING-zlib.txt
06/14/2018 02:31 PM 1,110 COPYING.txt
09/07/2018 09:47 PM <DIR> docs
09/07/2018 09:47 PM <DIR> include
09/07/2018 09:47 PM <DIR> lib
08/14/2018 12:45 PM 6,253 LICENSE-openssl.txt
08/27/2018 09:16 AM 19,351 mk-ca-bundle.pl
12/02/2017 11:33 PM 1,659 README.txt
09/05/2018 05:45 AM 10,698 RELEASE-NOTES.txt
12 File(s) 261,032 bytes
6 Dir(s) 856,113,029,120 bytes free
D:\practice\curl-7.61.1-win64-mingw>cd bin
D:\practice\curl-7.61.1-win64-mingw\bin>curl.exe start.spring.io
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Initializr :: https://start.spring.io
This service generates quickstart projects that can be easily customized.
Possible customizations include a project's dependencies, Java version, and
build system or build structure. See below for further details.
The services uses a HAL based hypermedia format to expose a set of resources
to interact with. If you access this root resource requesting application/json
as media type the response will contain the following links:
+-----------------+-----------------------------------------+
| Rel | Description |
+-----------------+-----------------------------------------+
| gradle-build | Generate a Gradle build file |
| gradle-project | Generate a Gradle based project archive |
| maven-build | Generate a Maven pom.xml |
| maven-project * | Generate a Maven based project archive |
+-----------------+-----------------------------------------+
The URI templates take a set of parameters to customize the result of a request
to the linked resource.
+-----------------+------------------------------------------+------------------------------+
| Parameter | Description | Default value |
+-----------------+------------------------------------------+------------------------------+
| applicationName | application name | DemoApplication |
| artifactId | project coordinates (infer archive name) | demo |
| baseDir | base directory to create in the archive | no base dir |
| bootVersion | spring boot version | 2.0.4.RELEASE |
| dependencies | dependency identifiers (comma-separated) | none |
| description | project description | Demo project for Spring Boot |
| groupId | project coordinates | com.example |
| javaVersion | language level | 1.8 |
| language | programming language | java |
| name | project name (infer application name) | demo |
| packageName | root package | com.example.demo |
| packaging | project packaging | jar |
| type | project type | maven-project |
| version | project version | 0.0.1-SNAPSHOT |
+-----------------+------------------------------------------+------------------------------+
The following section has a list of supported identifiers for the comma-separated
list of "dependencies".
+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------+
| Id | Description | Required version |
+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------+
| activemq | Java Message Service API via Apache ActiveMQ | >=1.4.0.RC1 |
| actuator | Production ready features to help you monitor and manage your application | |
| actuator-docs | API documentation for the Actuator endpoints | >=1.3.0.RELEASE and <2.0.0.M1 |
| amqp | Advanced Message Queuing Protocol via spring-rabbit | |
| aop | Create your own Aspects using Spring AOP and AspectJ | |
| artemis | Java Message Service API via Apache Artemis | >=1.3.0.RELEASE |
| azure-active-directory | Spring Security integration with Azure Active Directory for authentication | >=1.5.4.RELEASE |
| azure-keyvault-secrets | Spring value annotation integration with Azure Key Vault Secrets | >=1.5.4.RELEASE |
| azure-storage | Azure Storage service integration | >=1.5.4.RELEASE |
| azure-support | Auto-configuration for Azure Services (service bus, storage, active directory, cosmos DB, key vault and more) | >=1.5.4.RELEASE |
| batch | Spring Batch support | |
| cache | Spring's Cache abstraction | >=1.3.0.RELEASE |
| camel | Integration using Apache Camel | >=1.4.0.RELEASE |
| cloud-aws | AWS native services from spring-cloud-aws | >=1.2.3.RELEASE |
| cloud-aws-jdbc | Relational databases on AWS with RDS and spring-cloud-aws-jdbc | >=1.2.3.RELEASE |
| cloud-aws-messaging | Messaging on AWS with SQS and spring-cloud-aws-messaging | >=1.2.3.RELEASE |
| cloud-bus | A simple control bus using Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ) | >=1.2.3.RELEASE |
| cloud-cloudfoundry-discovery | Service discovery with Cloud Foundry | >=1.3.0.RELEASE |
| cloud-config-client | spring-cloud-config Client | >=1.2.3.RELEASE |
| cloud-config-server | Central management for configuration via a git or svn backend | >=1.2.3.RELEASE |
| cloud-connectors | Simplifies connecting to services in cloud platforms, including spring-cloud-connector and spring-cloud-cloudfoundry-connector | >=1.2.0.RELEASE |
| cloud-contract-stub-runner | Stub Runner for HTTP/Messaging based communication. Allows creating WireMock stubs from RestDocs tests | >=1.4.0.RC1 |
| cloud-contract-verifier | Test dependencies required for autogenerated tests | >=1.4.0.RC1 |
| cloud-eureka | Service discovery using spring-cloud-netflix and Eureka | >=1.2.3.RELEASE |
| cloud-eureka-server | spring-cloud-netflix Eureka Server | >=1.2.3.RELEASE |
| cloud-feign | Declarative REST clients with spring-cloud-netflix Feign | >=1.2.3.RELEASE |
| cloud-function | Functions as Spring Beans | >=2.0.2.RELEASE |
| cloud-gateway | Intelligent and programmable routing with the reactive Spring Cloud Gateway | >=2.0.0.M5 |
| cloud-gcp | Support for Google Cloud Platform services | >=2.0.0.RELEASE |
| cloud-gcp-pubsub | Publish to and subcribe from Google Cloud Pub/Sub topics | >=2.0.0.RELEASE |
| cloud-gcp-storage | Access Google Cloud Storage objects | >=2.0.0.RELEASE |
| cloud-hystrix | Circuit breaker with spring-cloud-netflix Hystrix | >=1.2.3.RELEASE |
| cloud-hystrix-dashboard | Circuit breaker dashboard with spring-cloud-netflix Hystrix | >=1.2.3.RELEASE |
| cloud-oauth2 | OAuth2 and distributed application patterns with spring-cloud-security | >=1.2.3.RELEASE |
| cloud-ribbon | Client side load balancing with spring-cloud-netflix and Ribbon | >=1.2.3.RELEASE |
| cloud-security | Secure load balancing and routing with spring-cloud-security | >=1.2.3.RELEASE |
| cloud-starter | spring-cloud-context (e.g. Bootstrap context and @RefreshScope) | >=1.2.3.RELEASE |
| cloud-starter-consul-config | Configuration management with Hashicorp Consul | >=1.3.0.RELEASE |
| cloud-starter-consul-discovery | Service discovery with Hashicorp Consul | >=1.3.0.RELEASE |
| cloud-starter-sleuth | Distributed tracing via logs with spring-cloud-sleuth | >=1.3.0.RELEASE |
| cloud-starter-vault-config | Configuration management with HashiCorp Vault | >=1.5.3.RELEASE |
| cloud-starter-zipkin | Distributed tracing with an existing Zipkin installation and spring-cloud-sleuth-zipkin. Alternatively, consider Sleuth Stream. | >=1.3.0.RELEASE |
| cloud-starter-zookeeper-config | Configuration management with Zookeeper and spring-cloud-zookeeper-config | >=1.3.0.RELEASE |
| cloud-starter-zookeeper-discovery | Service discovery with Zookeeper and spring-cloud-zookeeper-discovery | >=1.3.0.RELEASE |
| cloud-stream | Messaging microservices with Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ) | >=1.3.0.RELEASE |
| cloud-task | Task result tracking and integration with Spring Batch | >=1.3.0.RELEASE |
| cloud-turbine | Circuit breaker metric aggregation using spring-cloud-netflix with Turbine and server-sent events | >=1.2.3.RELEASE |
| cloud-turbine-stream | Circuit breaker metric aggregation using spring-cloud-netflix with Turbine and Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ) | >=1.3.0.RELEASE |
| cloud-zuul | Intelligent and programmable routing with spring-cloud-netflix Zuul | >=1.2.3.RELEASE |
| codecentric-spring-boot-admin-client | Register your application with a Spring Boot Admin instance | >=1.5.9.RELEASE |
| codecentric-spring-boot-admin-server | An admin interface for Spring Boot applications | >=1.5.9.RELEASE |
| configuration-processor | Generate metadata for your custom configuration keys | >=1.2.0.RELEASE |
| cxf-jaxrs | RESTful Web Services framework with support of JAX-RS | >=1.4.0.RELEASE |
| data-cassandra | Cassandra NoSQL Database, including spring-data-cassandra | >=1.3.0.RC1 |
| data-cassandra-reactive | Cassandra NoSQL Database, including spring-data-cassandra and the reactive driver | >=2.0.0.M1 |
| data-couchbase | Couchbase NoSQL database, including spring-data-couchbase | >=1.4.0.RELEASE |
| data-couchbase-reactive | Couchbase NoSQL database, including spring-data-couchbase and the reactive driver | >=2.0.0.M7 |
| data-elasticsearch | Elasticsearch search and analytics engine including spring-data-elasticsearch | |
| data-gemfire | GemFire distributed data store including spring-data-gemfire | >=1.1.0.RELEASE and <2.0.0.M1 |
| data-jpa | Java Persistence API including spring-data-jpa, spring-orm and Hibernate | |
| data-jpa | Java Persistence API including spring-data-jpa, spring-orm and Hibernate | |
| data-ldap | LDAP support, including spring-data-ldap | >=1.5.0.RC1 |
| data-mongodb | MongoDB NoSQL Database, including spring-data-mongodb | |
| data-mongodb-reactive | MongoDB NoSQL Database, including spring-data-mongodb and the reactive driver | >=2.0.0.M1 |
| data-neo4j | Neo4j NoSQL graph database, including spring-data-neo4j | >=1.4.0.RELEASE |
| data-redis | Redis key-value data store, including spring-data-redis | |
| data-redis | Redis key-value data store, including spring-data-redis | |
| data-redis-reactive | Redis key-value data store, including spring-data-redis | >=2.0.0.M7 |
| data-rest | Exposing Spring Data repositories over REST via spring-data-rest-webmvc | |
| data-rest-hal | Browsing Spring Data REST repositories in your browser | >=1.3.0.RELEASE |
| data-solr | Apache Solr search platform, including spring-data-solr | |
| derby | Apache Derby database (with embedded support) | >=1.2.2.RELEASE |
| devtools | Spring Boot Development Tools | >=1.3.0.RELEASE |
| flapdoodle-mongo | Embedded MongoDB for testing | >=1.3.0.RELEASE |
| flyway | Flyway Database Migrations library | |
| freemarker | FreeMarker templating engine | |
| groovy-templates | Groovy templating engine | |
| h2 | H2 database (with embedded support) | |
| hateoas | HATEOAS-based RESTful services | >=1.2.2.RELEASE |
| hsql | HSQLDB database (with embedded support) | |
| integration | Common spring-integration modules | |
| jdbc | JDBC databases | |
| jersey | RESTful Web Services framework with support of JAX-RS | >=1.2.0.RELEASE |
| jooq | Persistence support using Java Object Oriented Querying | >=1.3.0.RELEASE |
| kafka | Kafka messaging support using Spring Kafka | >=1.5.0.RC1 |
| kafka-streams | Support for building stream processing applications with Apache Kafka Streams | >=2.0.0.RELEASE |
| keycloak | Keycloak integration, an open source Identity and Access Management solution. | >=1.5.3.RELEASE |
| liquibase | Liquibase Database Migrations library | |
| lombok | Java annotation library which helps to reduce boilerplate code and code faster | |
| mail | Send email using Java Mail and Spring Framework's JavaMailSender | >=1.2.0.RC1 |
| mobile | Simplify the development of mobile web applications with spring-mobile | >=1.0.0.RELEASE and <2.0.0.M1 |
| mustache | Mustache templating engine | >=1.2.2.RELEASE |
| mybatis | Persistence support using MyBatis | |
| mysql | MySQL JDBC driver | |
| open-service-broker | Create service brokers that conform to the Open Server Broker API specification | >=2.0.0.RELEASE |
| postgresql | PostgreSQL JDBC driver | |
| quartz | Schedule jobs using Quartz | >=2.0.0.M2 |
| ratpack | Spring Boot integration for the Ratpack framework | >=1.2.0.RELEASE and <2.0.0.M1 |
| reactive-cloud-stream | Reactive messaging microservices with Spring Cloud Stream (requires a binder, e.g. Kafka or RabbitMQ) | >=2.0.0.RC2 |
| restdocs | Document RESTful services by combining hand-written and auto-generated documentation | |
| retry | Provide declarative retry support via spring-retry | >=1.3.0.RELEASE |
| scs-circuit-breaker | Hystrix circuit breaker on Pivotal Cloud Foundry | >=1.3.0.RELEASE |
| scs-config-client | Config client on Pivotal Cloud Foundry | >=1.3.0.RELEASE |
| scs-service-registry | Eureka service discovery on Pivotal Cloud Foundry | >=1.3.0.RELEASE |
| security | Secure your application via spring-security | |
| session | API and implementations for managing a userΓÇÖs session information | >=1.3.0.RELEASE |
| spring-shell | Build shell-based clients | >=1.5.0.RELEASE |
| sqlserver | Microsoft SQL Server JDBC driver | >=1.5.0.RC1 |
| statemachine | Build applications using state machine concepts | >=2.0.0.RC1 |
| thymeleaf | Thymeleaf templating engine | |
| vaadin | Vaadin java web application framework | >=1.2.0.RELEASE |
| validation | JSR-303 validation infrastructure (already included with web) | >=1.3.0.RELEASE |
| web | Full-stack web development with Tomcat and Spring MVC | |
| web-services | Contract-first SOAP service development with Spring Web Services | |
| web-services | Contract-first SOAP service development with Spring Web Services | |
| webflux | Reactive web development with Netty and Spring WebFlux | >=2.0.0.M1 |
| websocket | Websocket development with SockJS and STOMP | |
+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------+
Examples:
To create a default demo.zip:
$ curl https://start.spring.io/starter.zip -o demo.zip
To create a web project using Java 10:
$ curl https://start.spring.io/starter.zip -d dependencies=web \\
-d javaVersion=10 -o demo.zip
To create a web/data-jpa gradle project unpacked:
$ curl https://start.spring.io/starter.tgz -d dependencies=web,data-jpa \\
-d type=gradle-project -d baseDir=my-dir | tar -xzvf -
To generate a Maven POM with war packaging:
$ curl https://start.spring.io/pom.xml -d packaging=war -o pom.xml
No comments:
Post a Comment