Thursday 23 July 2020

Maven I getting Unknown error in line 1 of pom.xml?





if the maven packaging attribute is war then no problem.The problem is in jar type." So you can also fix this problem by changing packaging type.
<packaging>war</packaging>

Wednesday 3 June 2020

What is Spring Boot?

Spring Boot is a Framework from “The Spring Team” to ease the bootstrapping and development of new Spring Applications.
It provides defaults for code and annotation configuration to quick start new Spring projects within no time. It follows the “Opinionated Defaults Configuration” Approach to avoid lot of boilerplate code and configuration to improve Development, Unit Test, and Integration Test Process.
Spring typically requires a lot of configuration. Spring Boot simplifies this setup by providing defaults for many features. You can still adjust the defaults according to your needs.
Spring Boot is mostly used to create web applications but can also be used for command-line applications. A Spring Boot web application can be built to a stand-alone JAR. This JAR contains an embedded web server that can be started with java -jar. Spring Boot provides selected groups of auto-configured features and dependencies, which makes it faster to get started.
Spring Boot is a Spring framework module which provides RAD (Rapid Application Development)
Spring Boot is an open-source Java-based framework used to create a Micro Service. It is developed by Pivotal Team. It is easy to create a stand-alone and production-ready Spring applications using Spring Boot. Spring Boot contains comprehensive infrastructure support for developing a microservice and enables you to develop enterprise-ready applications that you can “just run”

What is Micro Service?

Micro Service is an architecture that allows the developers to develop and deploy services independently. Each service running has its own process and this achieves the lightweight model to support business applications.

Advantages

Micro services offers the following advantages to its developers −
  • Easy deployment
  • Simple scalability
  • Compatible with Containers
  • Minimum configuration
  • Lesser production time

What is Spring Boot?

Spring Boot provides a good platform for Java developers to develop a stand-alone and production-grade spring application that you can just run. You can get started with minimum configurations without the need for an entire Spring configuration setup.

Advantages

Spring Boot offers the following advantages to its developers −
  • Easy to understand and develop spring applications
  • Increases productivity
  • Reduces the development time

Goals

Spring Boot is designed with the following goals −
  • To avoid complex XML configuration in Spring
  • To develop a production ready Spring applications in an easier way
  • To reduce the development time and run the application independently
  • Offer an easier way of getting started with the application

Why Spring Boot?

You can choose Spring Boot because of the features and benefits it offers as given here −
  • It provides a flexible way to configure Java Beans, XML configurations, and Database Transactions.
  • It provides a powerful batch processing and manages REST endpoints.
  • In Spring Boot, everything is auto-configured; no manual configurations are needed.
  • It offers annotation-based spring application
  • Eases dependency management
  • It includes Embedded Servlet Container
  • The dependency injection approach is used in Spring Boot.
  • It contains powerful database transaction management capabilities.
  • It simplifies integration with other Java frameworks like JPA/Hibernate ORM, Struts, etc.
  • It reduces the cost and development time of the application.


What You Will build

You will build a simple web application with Spring Boot and add some useful services to it.create a Micro Service.


Is Spring MVC on the classpath? There are several specific beans you almost always need, and Spring Boot adds them automatically. A Spring MVC application also needs a servlet container, so Spring Boot automatically configures embedded Tomcat.


Advantages of Spring Boot

  • It creates stand-alone Spring applications that can be started using Java -jar.
  • It tests web applications easily with the help of different Embedded HTTP servers such as Tomcat, Jetty, etc. We don't need to deploy WAR files.
  • It provides opinionated 'starter' POMs to simplify our Maven configuration.
  • It provides production-ready features such as metrics, health checks, and externalized configuration.
  • There is no requirement for XML configuration.
  • It offers a CLI tool for developing and testing the Spring Boot application.
  • It offers the number of plug-ins.
  • It also minimizes writing multiple boilerplate codes (the code that has to be included in many places with little or no alteration), XML configuration, and annotations.
  • It increases productivity and reduces development time.

Limitations of Spring Boot

Spring Boot can use dependencies that are not going to be used in the application. These dependencies increase the size of the application.

Spring Boot Features

  • Web Development
  • SpringApplication
  • Application events and listeners
  • Admin features
  • Externalized Configuration
  • Properties Files
  • YAML Support
  • Type-safe Configuration
  • Logging
  • Security
Web Development
It is a well-suited Spring module for web application development. We can easily create a self-contained HTTP application that uses embedded servers like Tomcat, Jetty, or Undertow. We can use the spring-boot-starter-web module to start and run the application quickly.
SpringApplication
The SpringApplication is a class that provides a convenient way to bootstrap a Spring application. It can be started from the main method. We can call the application just by calling a static run() method.
  1. public static void main(String[] args)  
  2. {    
  3. SpringApplication.run(ClassName.class, args);    
  4. }  
Application Events and Listeners
Spring Boot uses events to handle the variety of tasks. It allows us to create factories file that is used to add listeners. We can refer it to using the ApplicationListener key.
Always create factories file in META-INF folder like META-INF/spring.factories.
Admin Support
Spring Boot provides the facility to enable admin-related features for the application. It is used to access and manage applications remotely. We can enable it in the Spring Boot application by using spring.application.admin.enabled property.
Externalized Configuration
Spring Boot allows us to externalize our configuration so that we can work with the same application in different environments. The application uses YAML files to externalize configuration.
Properties Files
Spring Boot provides a rich set of Application Properties. So, we can use that in the properties file of our project. The properties file is used to set properties like server-port =8082 and many others. It helps to organize application properties.
YAML Support
It provides a convenient way of specifying the hierarchical configuration. It is a superset of JSON. The SpringApplication class automatically supports YAML. It is an alternative of properties file.
Type-safe Configuration
The strong type-safe configuration is provided to govern and validate the configuration of the application. Application configuration is always a crucial task which should be type-safe. We can also use annotation provided by this library.
Logging
Spring Boot uses Common logging for all internal logging. Logging dependencies are managed by default. We should not change logging dependencies if no customization is needed.
Security
Spring Boot applications are spring bases web applications. So, it is secure by default with basic authentication on all HTTP endpoints. A rich set of Endpoints is available to develop a secure Spring Boot application.
To Start Opinionated Approach to create Spring Boot Applications, The Spring Team (The Pivotal Team) has provided the following three approaches.
  • Using Spring Boot CLI Tool
  • Using Spring STS IDE
  • Using Spring Initializr Website
We can develop two flavors of Spring-Based Applications using Spring Boot
  • Java-Based Applications
  • Groovy Applications

Key Components of Spring Boot Framework

Spring Boot Framework has mainly four major Components.
  • Spring Boot Starters
  • Spring Boot AutoConfigurator
  • Spring Boot CLI
  • Spring Boot Actuator
  • Spring Initilizr
  • Spring Boot IDEs