Spring_Boot

 

Chapter 1: Basics

  • J2SE-Java Standard Edition(Core Java)(Console application)
  • J2EE- Java Enterprise Edition(Advanced Java)(Enterprise level application-Company level application)
  • EJB-Enterprise Java Beans(Server-side component for java platform)
    • It enables rapid and simplified the development.

    • server side ( program run on server machine)

    • web server( Apache Tomcat, Jetty)

  • Hibernate(ORM-Object Relational Mapping tool)
    • It provides framework for object oriented model to relational database.

  • Spring Framework (Modern java based enterprise application on any kind of deployment  platform)



-----------------------------------------------------------------------------------------------------------------------------


Chapter 2: Introduction

Spring Boot:

Easy to create stand-alone, production grade, Spring based application that you can "just Run".

Opiniated view of the Spring platform


Configuration:

* JAR file: Java Archive files ---> Zip files containing  java class files.

* We need lot of  external jar file to do a project(e.g. project want to read a pdf file, want to connect           with browser.)

* JAR files for core java application

* WAR files: Web Archive files

* WAR files for web applications

* Collection of JAR and WAR files put into the configuration file.

* .class files placed in java build path

* When you compile a core java program it will change .class file but if you compile a web java                program it will change as War file.


Spring Features:

1. POJO (Plain Old Java Object) ----> class-contain private variables--->Access using getter setter            methods.

2. Dependency Injection
        + not mention the object name and class name directly which object is depend on.
        + Because if you directly mention the depended object directly you should edit it every time                        when you change the object
        + It avoid tightly coupling
        + Unit test will be easy
        + @Componenet creates a new object in spring container
        +@Autowired call the object and if multiple object mentioned then @Qualifier used to mention it              and also you should mention name of the object in @Component("xxx") 
        
3. REST API(Representational State Transfer- Application programming Interface)

      + connect between machines, simple HTTP is used to make calls between machines.
      client runs on a user’s computer and initiates communication
      + server that offers an API to access its data

      + resource, which is any piece of content that the server can provide to the client
      + To get access to a resource, the client sends an HTTP request (GET, POST, PUT, DELETE).
      + GET - Read/retrieve data from server
      + POST - send data to server
      + PUT - modify data on the server
      + DELETE - delete data on the server
      + In return, the server generates an HTTP response with encoded data on the resource.
      + In past SOAP technology is used for this purpose.

      4. MVC (Model View Controller)

        + Spring follows MVC pattern.
        + Controller instructing to model how to respond to user input
        + Model Storing and retrieving data
        + View rendering of model & UI

5. Separate web server is not needed for Spring boot.
6. No War files configuration and management

-----------------------------------------------------------------------------------------------------------------------------


Chapter 3: Maven 

Maven(Knowledge accumulator):

    * Configuration management tool
    * Software project management and comprehension tool
    * Used to accumulate jar files 
    * Gives default project structure
    * Dependencies auto download
    * That dependencies were auto compile
    * Server starting and stopping
    * POM file : 
                + Project Object Model
                + XML file
                + User put list of jar and war files with version they want to complete their project 
                + Maven automatically download these jar files from internet.


Develop a simple maven project:

* Open Eclipse
* File --> New --> Maven Project  or  File --> New --> Project --> Maven --> Maven Project


* If you don't check "skip archetype selection" checkbox then you can see all jar file list


* Check "skip archetype selection" checkbox then click next.


* Maven project is created

* This is maven structure


-----------------------------------------------------------------------------------------------------------------------------

                             
                           Chapter 4: Spring Boot Project 


* Open Eclipse
* File --> New --> Project  --> Spring Boot --> Spring Starter Project --> next
* New spring starter project window appeared.


* Fill the details and click next.





* pom.xml has project details and dependencies



* If you want to add more dependencies then go to "MVN Repository"(Google search) and search particular dependency(Apache poi).[local repo==our system, central repo ==mvn repo]


* Choose version and select maven for dependency


* Copy the above maven dependency and paste it in pom.xml file

* This maven dependency has Group id, Artifact id and version , this information is enough for               pom.xml file to download the above jar file from internet. 

* Go to src > main > java > com > SpringBoot > Myproject1Application




* @SpringBootApplication --> annotation tells the compiler it is the Spring Boot application.

* SpringApplication . run (Myspproject1.class) --> Run this application as a spring application

* For create new class right click on your project in Project explorer choose  New > Class


* Declare variables



* To give getter and  setter method for the variable then right click the class name and choose source >     generate getter and  setter method.










profiles of spring boot










Comments

Popular posts from this blog

React_JS

Java_Script

DSA