Professional Documents
Culture Documents
Que & Ans PDF
Que & Ans PDF
framework?
ANS:
Spring framework is a Injection dependency framework at first targeting managing life-cycle of
Java components (beans). Today, Spring framework is pretty bloated with tons facilities/helpers
on top of it. But if you look at the big picture, it is still a framework that glue things together, a
middle man to MVC frameworks (Struts 1,2, JSF etc), ORM frameworks (Hibernate, iBatis, JOOQ
etc) and other necessary facilities (Quartz, Email, you can tell, whatever you need, most likely,
there's a Spring support). It takes quite a lengthy tutorial to set Spring framework up and
running because Spring framework nature is to provide flexibility of choices to you.
Spring boot on the other hand is built on a totally different mantra. It's basically a suite, pre-
configured, pre-sugared set of frameworks/technologies to reduce boiler plate configuration
providing you the shortest way to have a Spring web application up and running with smallest
line of code/configuration out-of-the-box. As you can see from there Spring Boot page, it took
less than 20 lines of code to have a simple RESTful application up and running with almost zero
configuration. It definitely has a ton of way to configure application to match your need.
Configuration To design any spring based application, a To Design all those common set up, a
developer needs to be taken care on developer doesn’t need to define
manual set up on Hibernate data source, everything individually,
Entity Manager, Session Factory, SpringBootConfiguration annotation
Transaction Management everything. enough to manage everything at the
time of deployment.
XML Spring MVC application some of the XML Configuring Spring Boot Application
definition mandatory to manage. nothing needs to be managed, the
only annotation managed everything.
Use Better to use if application type or Better to use where application type
characteristics are purely defined. of functionality for future use not
properly defined. As integrating any
Spring specific feature will be auto-
configured in here, so no need any
additional configuration.
Default lifecycle:
The default lifecycle has the following build phases:
1. validate: validate the project is correct and all necessary information is available.
2. compile: compile the source code of the project.
3. test: test the compiled source code using a suitable unit testing framework. These tests
should not require the code be packaged or deployed.
4. package: take the compiled code and package it in its distributable format, such as a
JAR.
5. integration-test: process and deploy the package if necessary into an environment
where integration tests can be run.
6. verify: run any checks to verify the package is valid and meets quality criteria.
7. install: install the package into the local repository, for use as a dependency in other
projects locally.
8. deploy: done in an integration or release environment, copies the final package to the
remote repository for sharing with other developers and projects.
These lifecycle phases (plus the other lifecycle phases not shown here) are executed
sequentially to complete the default lifecycle.
To do all those, we only need to call the last build phase to be executed, in this case, deploy:
That is because if we call a build phase, it will execute not only that build phase, but also every
build phase prior to the called build phase.
mvn clean install
The following command tells Maven to do the clean action in each module before running
the install action for each module.
In other words, mvn clean install clears any compiled files we have, making sure that we're
really compiling each module from scratch.
If this were to be executed, the clean phase will be executed first (meaning it will run all
preceeding phases of the clean lifecycle, plus the clean phase itself), and then
the dependency:copy-dependencies goal, before finally executing the package phase (and all
its preceeding build phases of the default lifecycle).
POJO:- POJO is a Java object not bound by any restriction other than those forced by the Java
Language Specification.
Properties of POJO :