For Example: Suppose We Have An Object Employee and It Has A Dependency On
For Example: Suppose We Have An Object Employee and It Has A Dependency On
Spring Boot uses Commons Logging for all internal logging and you can change log levels by
First of all Spring Boot is not a framework, it is a way to ease to create stand-alone application adding following lines in the application.properties file:
with minimal or zero configurations. It is approach to develop spring based application with very logging.level.org.springframework=DEBUG
less configuration. It provides defaults for code and annotation configuration to quick start new
spring projects within no time. logging.level.com.demo=INFO
Spring Boot automatically configures required classes depending on the libraries on its
classpath. Suppose your application want to interact with DB, if there are Spring Data libraries on What are safe REST operations?
class path then it automatically sets up connection to DB along with the Data Source class. REST API uses HTTP methods to perform operations. Some of the HTTP operations which
doesn't modify the resource at the server is known as safe operations e.g. GET and HEAD. On
the other hand, PUT, POST, and DELETE are unsafe because they modify the resource on the
Question 2. What Are The Advantages Of Using Spring Boot? server.
o It is very easy to develop Spring Based applications with Java
o It reduces lots of development time and increases productivity.
o It avoids writing lots of boilerplate Code, Annotations and XML Configuration. What are idempotent operations? Why is idempotency important?
o It is very easy to integrate Spring Boot Application with its Spring Ecosystem like There are some HTTP methods e.g. GET which produce same response no matter how many
Spring JDBC, Spring ORM, Spring Data, Spring Security etc. times you use them e.g. sending multiple GET request to the same URI will result in same
o It follows “Opinionated Defaults Configuration” Approach to reduce Developer effort response without any side-effect hence it is known as idempotent.
o It provides Embedded HTTP servers like Tomcat, Jetty etc. to develop and test our
web applications very easily. On the other hand, the POST is not idempotent because if you send multiple POST request, it will
result in multiple resource creation on the server, but again, PUT is idempotent if you are using it
Question 3. What do Dev Tools in Spring boot mean? to update the resource.
Spring boot accompanies Dev Tools, so You don’t have to redeploy your application each time
you influence the changes. The developer can reload the progressions without restart of the Even, multiple PUT request to update a resource on a server will give same end result. You can
server. <artifactId>spring-boot-devtools</artifactId> further take HTTP Fundamentals course by Pluralsight to learn more about idempotent methods
of HTTP protocol and HTTP in general.
Question 4. What Is Actuator In Spring Boot?
prototype – A new instance will be created every time the bean is requested from the spring @Lazy
container.
This annotation is used on component classes. By default all autowired dependencies are
request – This is same as prototype scope, however it’s meant to be used for web applications.
created and configured at startup. But if you want to initialize a bean lazily, you can
A new instance of the bean will be created for each HTTP request. use @Lazy annotation over the class. This means that the bean will be created and initialized
only when it is first requested for
session – A new bean will be created for each HTTP session by the container.
@EnableAutoConfiguration
global-session – This is used to create global session beans for Portlet applications.
Some Annotations This annotation is usually placed on the main application class.
The @EnableAutoConfiguration annotation implicitly defines a base “search package”. This
@Required annotation tells Spring Boot to start adding beans based on classpath settings, other beans, and
various property settings.
This annotation is applied on bean setter methods. Consider a scenario where you need to @SpringBootApplication
enforce a required property. The @Required annotation indicates that the affected bean must be
populated at configuration time with the required property. Otherwise an exception of
This annotation is used on the application class while setting up a Spring Boot project. The class
type BeanInitializationException is thrown.
that is annotated with the @SpringBootApplication must be kept in the base package
@Autowired
@ControllerAdvice