Spring Quetions-1
Spring Quetions-1
Spring Boot CLI is a command-line tool that can be used to create, run, and manage
Spring Boot applications. It is a powerful tool that can help us to get started with Spring
Boot quickly and easily. It is built on top of the Groovy programming language.
-run
-test
-jar
-war
–init
-help
@Component: This annotation is the most generic annotation for any Spring-managed
component. It is used to mark a class as a Spring bean that will be managed by the
Spring container.
14. Is it possible to change the port of the embedded Tomcat server in Spring Boot?
Yes, it is possible to change the port of the embedded Tomcat server in a Spring Boot
application.
The simple way is to set the server. port property in your application’s
application.properties file. For example, to set the port to 8081, add the following
property to the application.properties file:
server.port=8081
Spring Boot Starters are a collection of pre-configured maven dependencies that makes
it easier to develop types of applications. These starters include,
Dependencies
Version control
To use a Spring Boot starter dependency, we simply need to add it to our project’s
pom.xml file. For example, to add the Spring Boot starter web dependency, add the
following dependency to the pom.xml file:
The default port of the embedded Tomcat server in Spring Boot is 8080. We can change
the default port by setting the server.port property in your application’s
application.properties file.
17. Can we disable the default web server in the Spring Boot application?
Yes, we can disable the default web server in the Spring Boot application. To do this, we
need to set the server.port property to “-1” in the application’s application.properties
file.
@EnableAutoConfiguration(exclude = {//classname})
Yes, we can create a non-web application in Spring Boot. Spring Boot is not just for web
applications. Using Spring Boot, we can create applications like Microservices, Console
applications, and batch applications.
20. Describe the flow of HTTPS requests through the Spring Boot application.
First client makes an HTTP request (GET, POST, PUT, DELETE) to the browser.
After that the request will go to the controller, where all the requests will be mapped and
handled.
After this in Service layer, all the business logic will be performed. It performs the
business logic on the data that is mapped to JPA (Java Persistence API) using model
classes.
In repository layer, all the CRUD operations are being done for the REST APIs.