Springboot Devops
Springboot Devops
● Simple scalability
Spring Boot provides a good platform for Java developers to develop a stand-alone and
production-grade spring application that you can just run.
5. What are the features and benefits provided by the spring boot ?
Ans: 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.
Ans: Handling dependency management is a difficult task for big projects. Spring Boot resolves
this problem by providing a set of dependencies for developers convenience.
10. What is the use of spring boot starter thyme leaf dependency ?
Ans: Spring Boot Starter Thyme Leaf dependency is used to create a web application.
12. Who automatically configures your spring application based on the JAR dependencies
you added in the project ?
Ans: Spring Boot Auto Configuration automatically configures your Spring application based
on the JAR dependencies you added in the project.
15. Who provides a number of starters to add the jars in our class path ?
Ans: Spring Boot provides a number of Starters to add the jars in our class path.
16. Which class file allows you to configure the application when it is launched by using
servlet container ?
Ans: Spring Boot Servlet Initializer class file allows you to configure the application when it is
launched by using Servlet Container.
Note: For Maven, use the command mvn package for packaging your application. Then, the
WAR file will be created and you can find it in the target directory.
A class that does not have any package declaration is considered as a default package.
17. What is @ComponentScan ?
Ans: The @ComponentScan annotation is used to find beans and the corresponding injected
with @Autowired annotation.
20. Who convert the command line properties into spring boot environment properties ?
Ans: Spring Boot application converts the command line properties into Spring Boot
Environment properties.
Note:
Command line properties take precedence over the other property sources.
22. Who supports YAML based properties configurations to run the application ?
Ans: Spring Boot supports YAML based properties configurations to run the application.
Note:
Spring Boot supports different properties based on the Spring active profile.
24. What is the name of logging used by spring boot for all internal logging ?
Ans: Spring Boot uses Apache Commons logging for all internal logging. Spring Boot’s default
configurations provides a support for the use of Java Util Logging, Log4j2, and Logback.
25. In spring boot, What are the different types of logger levels ?
Ans: Spring Boot supports all logger levels such as “TRACE”, “DEBUG”, “INFO”, “WARN”,
“ERROR”, “FATAL”, “OFF”.
Note:
For building a RESTful Web Services, we need to add the Spring Boot Starter Web dependency
into the build configuration file.
Note:
You can use the Interceptor in Spring Boot to perform operations under the following
situations −
● Before sending the request to the controller
36. What are the three methods you should know while working on Interceptors ?
Ans: The following are the three methods you should know about while working on
Interceptors −
● preHandle() method − This is used to perform operations before sending the request to
the controller. This method should return true to return the response to the client.
● postHandle() method − This is used to perform operations before sending the response
to the client.
Ans: Thymeleaf is a Java-based library used to create a web application. It provides a good
support for serving a XHTML/HTML5 in web applications.
Note: For injecting Mockito Mocks into Spring Beans, we need to add the Mockito-core
dependency in our build configuration file.
With the help of SpringJUnit4ClassRunner and MockMvc, we can create a web application
context to write Unit Test for Rest Controller file.
Note:
Spring Boot application automatically requires the Basic Authentication for all HTTP
Endpoints. The Endpoint “/” and “/home” does not require any authentication. All other
Endpoints require authentication.