Introduction to Spring Boot
Spring Boot is a powerful Java-based framework built on the Spring Framework, designed to simplify the development of standalone, production-grade Spring applications. It offers stability, JVM-based performance, excellent connectivity with databases, cloud-native capabilities, flexibility, and is open-source.
Why Use Spring Boot?
- Stability: Backward compatible changes ensure smooth application migration.
- JVM-Based: Leverages Java Virtual Machine for robust, mission-critical applications.
- Connectivity: Supports relational and NoSQL databases like Oracle, MySQL, MongoDB, Redis.
- Cloud Native: Ready for cloud deployment with Spring Cloud integration.
- Flexibility: Supports web apps, RESTful services, batch jobs, and command-line apps.
- Open Source: Free to use with a large community.
Spring Boot Developer Salary Trends
In the US, Spring Boot developers earn around $100K annually, reflecting high demand in multinational companies.
Key Interview Questions and Answers
1. Difference Between Spring and Spring Boot
- Spring is a Java web application framework.
- Spring Boot is a module of Spring that simplifies project setup with auto-configuration and starter dependencies.
- Spring Boot is less complex and opinionated, reducing developer effort.
2. What is Spring Boot and Its Need?
- A Spring module for rapid application development.
- Provides auto-configuration, embedded servers, CLI tools, and starter dependencies.
3. Advantages of Spring Boot
- Auto-configuration for quick startup.
- Standalone applications with embedded servers (Tomcat, Jetty).
- Opinionated defaults reduce configuration.
- CLI tools for development and testing.
- Integration with Spring ecosystem (JDBC, ORM, Security).
4. Features of Spring Boot
- Spring CLI for coding and avoiding boilerplate.
- Starter dependencies for common libraries.
- Spring Initializer for project scaffolding.
- Auto-configuration and Actuator for monitoring.
- Logging and security features.
5. Creating Spring Boot Application Using Maven
- Use Spring Initializer, Spring Boot CLI, or IDE wizards.
- Import Maven project with
pom.xml
.
6. External Configuration Sources
application.properties
or.yml
files.- Command-line arguments.
- Profile-specific properties for environment-based configs.
7. Spring Boot Starters
- Predefined dependency sets like
spring-boot-starter-web
,spring-boot-starter-data-jpa
,spring-boot-starter-security
.
8. Spring Actuator
- Provides production-ready endpoints for monitoring app health, metrics, and environment.
- Secured via Spring Security.
9. Dependency Management
- Automatically manages versions of dependencies to avoid conflicts.
10. Minimum Requirements
- Java 8+, Spring Framework 5.1.9+, Maven 3.3+, Servlet containers like Tomcat 9.
11. Thymeleaf Template Engine
- Server-side Java template engine integrated with Spring for web apps.
12. Changing Embedded Tomcat Port
- Set
server.port
property inapplication.properties
.
13. Spring Boot DevTools
- Enhances development with automatic restarts and live reload.
14. Connecting to Database Using JDBC
- Create database and tables.
- Add JDBC and database dependencies.
- Configure datasource in
application.properties
. - Use
JdbcTemplate
or repositories for data operations.
15. HTTP/2 Support
- Enable by setting
server.http2.enabled=true
.
16. RequestMapping vs RestController
@RequestMapping
maps HTTP requests to methods.@RestController
combines@Controller
and@ResponseBody
for REST APIs.
17. Spring Boot CLI
- Tool to run Groovy scripts and manage Spring Boot apps.
18. JPA vs Hibernate
- JPA is a specification; Hibernate is an implementation.
19. Custom Endpoints in Actuator
- Use
@Endpoint
or@WebEndpoint
annotations.
20. Spring Data
- Simplifies data access for relational and NoSQL databases.
21. Auto-Configuration
- Automatically configures beans based on classpath and properties.
- Disable with
exclude
attribute in@EnableAutoConfiguration
.
22. Deploying as JAR or WAR
- Use Spring Boot Maven plugin.
- Set packaging type in
pom.xml
.
23. Read-Only Transactions
- Use
@Transactional(readOnly=true)
for read operations.
24. Profiles for Environment-Specific Configurations
- Define properties files like
application-dev.properties
. - Activate profiles via command line or properties.
25. Adding Custom JS
- Place static files under
src/main/resources/static
.
26. Relaxed Binding
- Property names can be flexible in configuration binding.
27. Default H2 Database Name
testdb
is the default in-memory database name.
28. Using Jetty Instead of Tomcat
- Exclude Tomcat dependency and add Jetty starter.
Conclusion
This session covered essential Spring Boot interview questions with detailed explanations and examples. Understanding these concepts will help you confidently tackle Java Spring Boot developer interviews and build robust applications.
For further preparation, check out the Top 10 Spring Boot Interview Questions with Answers & Examples and the Java Programming: A Comprehensive Guide to Understanding Java and Its Concepts. If you're also interested in front-end technologies, consider reviewing the Top 10 Angular Interview Questions for Beginners and Juniors for a well-rounded skill set.
[Music] hello the society on behalf of Adi Rekha and I welcome you to the session on
spring boot interview questions in the session guys will mainly focus on the top questions asked the little spring
boot so on that note let's get started with today's session so without wasting any further time let's take a look at
the topics for today's session so the topics for today's session are really simple we'll start this session by
understanding why should you use spring boot and then I'll tell you about the job turns of springboard after that
we'll get into the main topic for today's session that is a top 50 spring boot interval questions so let's get
started then but before that I would like to request all of you to subscribe to our ad Rekha YouTube channel to get
daily notified on the top trending technologies so let's start with the first topic for today's session that is
why should you use springboard now why do you think you have to use springboard well if I talk about spring boat then
let me tell you that you know spring boat comes from Spring Framework and obviously that is related to Java right
so anybody who's aspiring to become a Java developer may be a spring good Java developer then he or she must have a
good understanding about how you can use springboard and how it makes a life easy right so if you ask me why should you
use springboard then the reasons are as you can see on my screen well spring would provide
stability it is based on the Java Virtual Machine it provides good connectivity it is cloud native it has
good flexibility and this open source right so talking about stability first I would say springboard is stable as the
core and the central models in the spring ecosystems are for a long time and most changes are backward compatible
so what I mean by tight is that your even if spring boot is releasing any specific change right it announces that
particular change along back before so that you know all the applications that are built based on springboard can get
updated automatically right so in this way it provides a smooth migration path of your application and make sure that
your there is no problem in the working of the application coming to the next factor that the springboard is based on
the java virtual machine as we all know that you know spring is Java based right so when I said spring butyou should
understand that you know it comes from spring spring is completely based on Java right
so since spring is based in Java and thus obviously it depends on the Java Virtual Machine right now in any
application if you talk in real life in any in the industries any application can be based in Java right any kind of
application either from a small web application to a to-do application any kind of application can be based in Java
right so there's no doubt in the fact that you know Java and JVM have proven themselves of running mission-critical
applications for over 20 years now right also if he talked and spring boot apps can be developed in the JVM
language with being Java and Cortland as first-class citizens in the spring ecosystems coming to the next factor
that is connectivity so what I mean by connectivity is that you know spring makes it very easy for you to connect
with the relational databases no sequel databases or even queue services or you can just understand that it makes it
easy to connect with any data access technologies right so spring basically supports Oracle Postgres sequel my
sequel MongoDB Redis and so on right so if you just have to connect to any kind of database then springboard is your
go-to solution after connectivity we have cloud native so what I mean by cloud native is that you know spring
boot follows the deployment principles of cloud applications and is ready for the cloud out of box so basically with
spring boot and spring cloud together you can build distributed systems in an easy manner right so whenever you want
to build large critical applications and then you have to use a cloud service for your storage you know you can always go
forward and use spring cloud with springboard and build your distributed systems also whenever you build that
application what happens is that you know you can run it on your server virtual machines or it with containers
or maybe even hosts on any cloud provider like you know AWS as your and so on so basically the I springboard
comes with all these features coming to flexibility when I say flexibility what I mean by that is that you know spring
boot allows you to develop typical server-side rendered web applications restful services are the
web api is or even create bad jobs and regular command line applications in an easy manner right so basically with
spring boot guys you can create any kind of application that you wish to starting from a simple web api to a command line
tool to a command line application or even a large-scale web application right so that was about flexible
and coming to the last point that is open-source I think all of us understand that you know springboard can be easily
downloaded and then you can use springboard in your applications and build the applications in an easy manner
right basically it is just free to use and you can make sure that you know your applications can rely on springboard so
if someone asks you why you should use spring booth and here are your reasons it provides stability it's based on JVM
it provides good connectivity that is basically connecting with databases it's cloud native it has good flexibility and
it's definitely open source so I hope that you've understood why you should use springboard right now multinational
companies are using spring boots for the small applications to make applications so obviously when these companies are
using springboard then these developers who can work on springboard so on that note next in this session let's look at
the salary trend of a spring boot developer so when I say spring boot developer please don't stick around to
that you know he's only respective springboard so as you can see in my screen in United States a Java developer
or you could just understand that in a java spring boot developer owns around 100 K dollar skies so that's the huge
number per year right so that's a big number so not just with respect to Java spring boot developer but I would just
say that you know if you go for a Java developer role which is quite a popular role then you'll see that you know
spring boot and spring is one important framework that organizations are looking for right so if you're someone who is
aspiring to become a Java developer or maybe a spring boot Java developer then I think I can help you with the session
on and 2b questions and make you get prepared for the top questions that are are silly little spring boot right so on
that note let's get started with the main topic for today's session that is spring boot interview questions so
starting with question number one what do you think are the differences between spring and spring boot now this is
something very simple question guys at you know obviously when I say that you know spring has come from springboard
many people have this confusion between what exactly spring is and what exactly spring boot is well let me clear the
confusion for you well spring is just a web application framework based on Java and spring boot is a module of spring
coming to spring it provides tools and libraries to create customized web applications where a spring boot is
basically used to create a spring application project which you can just run
execute talking about the complexity level I would say spring is more complex than springboard and obviously
springboard is less complex and spring because you know it provides ways kinds of annotations which makes your life
easy right so when you start using springboard you understand that you know if you have to do some tasks then you
already have a predefined annotation for it you just have to import that particular annotation and then check the
required parameters and then you're good to go so in that way bring boot is less complex and spring
and coming to the fourth point that you know spring takes an unaffiliated view whereas spring boot takes an opinionated
view of the platform so if someone asks you the differences between spring and springboard then make sure that you know
you mention that you know spring is a web application framework based on Java whereas springboard is a model of spring
and the other difference is like you know it provides libraries to create an application where a springboard
basically is used to create a spring application project so these are the basic differences between spring and
spring boot you can also answer the interviewer you know how a particular application can be built and then what
are the difficulties that you face in spring and how they're overcome the springboard right so I hope that you
have understood the differences between spring and spring boot on that note let's look at the second question that
is what is spring boot and what is the need for it so if you ask me what springboard what I would answer is that
you know springboard is basically a spring module which aims to simplify the use of spring framework for Java
development so if you're building applications then basically springboard should be your go-to solution so
springboard is basically used to create a standalone spring based applications which you can just run and it aims at
rapid application development right so if you want break critical applications in a fast manner and then you want to
make sure that you know that it works perfectly fine and then you don't want to include lot of libraries but you just
want to use annotations then Springwood is your go-to solution so if you ask me what is the need of it I would just say
that you know springboard comes with Auto dependency their solutions embedded HTTP servers Auto configuration
management endpoints and Springwood CLI which makes the life of a developer very easy to build an application so that was
about what springboard and what is the need of it guys let's move on to the next question what are the advantages of
spring boot well the advantages of spring boot are quite a number but if you ask me to name a few
I would say Springwood provides auto-configuration to load a set of default configuration for a quick start
of the application it creates standalone applications with the range of non-functional features
that are common to large classes of project it also comes with embedded Tomcat server servlet containers and
jetty to avoid the usage of war files which is the big thing now because you know nobody wants to use war files for
their applications Ringwood also provides an opinionated view to reduce the developer's effort and simplify the
Maven configurations it provides CLI tool to develop and test applications it also comes with spring boot starters to
ensure dependency management and also provides various security metrics it consists of a wide range of api is for
monitoring and managing applications in the development side and also on the prod side and finally it also integrates
with spring ecosystem like spring JDBC spring ORM spring data spring security and makes it easy to avoid the
boilerplate code right so guys these are the various advantages of spring boo now let's move forward with the next
question that is mentioned few features of spring boot so if you ask me to mention few features of spring boot what
comes first on to my mind is spring CLI for any tool that you use that is basically the GUI CLI is something that
fascinates everyone so the first feature that I would say is spring CLI so spring mode CLI basically allows you to write
your code it grew me for writing spring boot applications and also avoid boilerplate code the next feature that I
think is to start a dependency so with the help of the starter dependency the spring would provides spring would
aggregates common dependencies together and eventually improves productivity on a large scale coming to the next feature
that is spring initializer well spring initializer is basically a web application which can create an internal
project structure for you so you basically do not have to set up the structure of the project yourself
instead you can just use this feature and set the structure for you coming to the next feature that is auto
configuration well the auto configuration feature of Springwood helps in loading the default
configuration according to the project that you're working on so basically in this way you again avoid the war files
coming to spring actuator well this feature basically provides help while running springboard applications and
finally coming to the last feature that is logging in security was the logging and the security feature of spring boot
ensures that all the made using springboard are properly secured and then you know all the
factors are basically put in a log file so that you know if there's any error that comes up the developer can easily
debug that error so basically guys these are the main features of springboard that spring CLI start a dependency
spring initializer Auto configuration spring actuator and logging in security now let's move on to the next question
that is explained how to create a springboard application using maven well this is one of the basic questions that
you can be asked in your interviews that you know what are the different ways to basically create a Springwood
application using maven well there are based approaches to create a Springwood application or using
maven but if I have to name a few then the most common ones are the spring boots Eli's the spring start a project
wizard the spring initializer and the spring maven project now let's move forward with the next question that is
what are the possible sources of external configuration right so there's no doubt in the fact that innerspring
boot allows the developers to run the same application in different environments well this is definitely
done with the support it provides for the external configuration so basically what happens is that in a springboard
users environment variables property files and command-line arguments yeah Mel files and system properties to
mention the required configuration properties also the added value annotation is used to gain access to
these properties right so if you ask me the most possible sources of external configuration are the application
properties command line properties and profile specific properties talk about application properties by default
springboard searches for the application properties file or HTML file in the current directory class path route or
the convict directory to load the properties come in to command line properties Springwood provides command
line arguments and converts these arguments to the properties and finally it adds them to the set of environment
properties and finally coming to profile specific properties these properties are loaded from the application profiles or
properties file or HTML file so basically this file resides in the same location as that of the non specific
property files and the profile placeholder refers to an active profile so if you ask me the most possible
sources of external configuration that its application properties command line properties and profile specific
properties so that was about this quest guys moving on to the next question that is can you explain what happens in the
background when a Springwood application is executed as run as java application so whenever a Springwood application is
executed as run as java application it automatically launches the Tomcat server as soon as it sees a web application so
remember guys whenever you're developing a web application and then you execute that particular project as a java
application automatically the Tomcat server is launched now let's move forward with the next question that is
what are the spring boot starters and what are the different start is provided by spring boot
well spring boot starters are basically a set of convenient dependency management providers which can be used
in the application to enable different kinds of dependencies so basically these starters make development easy and rapid
and all the available starters come under the group all good Spring Framework torpor so if you ask me guys
what are spring boot starters then just remember that you know the answer is really simple they're basically a set of
convenient dependency management providers which can be basically used to put in the application dependencies for
your application so whatever dependencies are required for the application you can get it
through the spring boot starters now the popular status of spring boot are as you can see on my screen while it is a
spring boot starter itself the spring would start at JDBC the spring would start a web ring would start the data
GPA the spring would start the security the spring would start the EOP and the spring boot starts a test talking about
the spring would start if worse well this is basically the course starter and it includes the logging or the
configuration support and the Yama files coming to spring would start at JDBC this starter is basically used for
hierarchy CP connection pool with JDBC coming to spring would start a web well this starter is basically used for
building web applications including restful applications using spring MVC talking about spring would start a data
JPA this start is basically used to use the spring data JPA with hibernate coming to
security that is the spring boot start the security this starter as the name suggests is basically used for the
spring security coming to the next one that spring would start at a o P this starter is basically used for
aspect-oriented programming with aspectj and spring AOP and finally coming to spring boot start a test
this data is basically used for testing springboard applications so guys these are the few com
starters that you need to know about when you attend interviews for us Java spring boot developer now moving on to
the next question that is what a spring actuator and what are its advantages well spring actuator is basically a cool
feature of spring boot with the help of which you can see what is happening inside a running application so whenever
you want to debug your application and you need to analyze the lock you basically have to understand what is
happening in the application right so in such scenario the spring actuator provides easy access to these features
such as identifying beans CPU usage and many more so you can just understand that you know spring boot actuator
provides a very easy way to access the production ready rest points and fetch all kinds of information from the web
now if you ask me how are these points secured well these points are secured by using the spring securities content
negotiation strategy so that is what spring actuated is guys it's basically a feature with the help of which you can
understand what is happening inside an application now moving on to the next question that is what a spring board
dependency management if someone asks you what a spring board a patent and the answer is very simple guys that it is
basically used to manage dependencies and configuration automatically without you specifying the version for any of
that dependencies so basically whenever you want to include any dependency for your application you don't have to
mention the version of it automatically the Springwood dependency management will figure out what version is required
for the application and it will download that particular dependency for the application so guys that was about
spring for dependency management moving on to the next question that is what are the minimum requirements to set up a
spring boot system well guys this is something way basic that you need to know when you're working on a spring
boot environment so for springboard to point 1.7 release you basically need Java eight or mode or the further
versions of that you need Spring Framework of five point one point nine or even you know higher versions of that
for explicit build support you need maven three point three version or even the further versions can work coming to
cradle you need Gradle four point four version or more than that and coming to servlet container suppose you basically
need Tomcat nine point zero jetty nine point four and on the Tao 2 point zero so guys these are the basic requirements
of a spring boot system let's move on with the next question that is what is time leaf and how to
use this time leave well time leave is basically a server-side Java template engine useful web applications it aims
to bring natural template for your web application and can integrate well with Spring Framework and HTML Java web
applications so if you have to use time leave you basically have to add a dependency for time leaf so the
dependency code is as you can see on my screen you have to basically add the group ID of all the Spring Framework
toutput and in the artifact ID you have to add the starter project for time leave that a spring boot starts a timely
and everything should be inside the dependency tags so if you have to understand time leave guys it's really
simple it's basically a server-side Java template engine used for web applications now let's move forward with
the next question that is can be changed a port of an embedded tomcat server in springboard well I would say yes we can
definitely change the port of an embedded tomcat server by using the application or properties file so
basically in this file you have to add a property known as server port and assign it to any port that you wish to for
example if you want to assign it to a t8 you want then you have to mention server dot port equal to 80 81 once you
mentioned the port number the application properties file will be automatically loaded by springboard and
the required configurations will be applied onto the application so just remember that whenever you want to
change the port of an embedded tomcat server you have to use this property of server that port and assign it to a new
port so let's move forward with the next question that is what is the need for Springwood dev tools
well springboard dev tools is basically an elaborated set of tools and aims to make the process of developing an
application easier so if the application runs in the production that this module is automatically disabled and the
packaging of archives is also excluded by default the springboard developer tools basically applies the properties
to the respective development environments and to include these theft tools you have to again add the
dependency that you can see on my screen that is basically the group ID stands the same as that of the previous
question four times if that is or got Spring Framework dot port but in the artifact ID you have to add spring -
boot - type tools so as that is what basically springboard F toeses it's basically an elaborated set of tools and
aims to make the process of developing an application easier so now let's move forward with the next question that is
mentioned the steps to create a spring boot project using spring initializer now this is something
that you know that is very basic to understand that you know how do you actually start creating a project using
spring initializer but before I tell you how to create a project let me just tell you that your spring initializer is
basically a web tool provided by spring framework itself so with the help of this tool you can create a spring boot
project by just providing the project details right so if you have to just create a spring pool project what do you
have to do is you have to choose the maven project and add the required dependencies for example you can add web
Joe CH 2 and so on and then what you have to do is you have to fill other required details like you know the group
ID the artifact and then finally click on generate project once you think the project is downloaded you have to
extract the project onto your system and then you have to import this project using the import option on the spring
tool suit ID that is basically the STS ID through which you can use spring boot but while importing the project please
remember that you know you have to choose the project type to be maven and the source project should contain the
form dot XML file right so just remember that you know to create a spring project using spring initializer you first have
to choose a main project and add require dependencies then you have to mention on the few details like you know group ID
artifact ID and so on once you're done with that I you'll just download that project and then you'll just import that
particular project onto your spring tool suit ID where you'll choose the formed an XML file so guys that was about
spring initializer and how to create a project using the spring initializer let's move forward with the next
question that is what are the steps to connect a spring boot application to a database using JDBC well the spring
would start the project provides the required libraries to connect the application with JDBC so for example its
inner you have to create an application and connect it with the my sequel database what you have to do is you have
to first create a database in my sequel right so to create a database in my sequel you mentioned the command create
database and then you mention the database name so for example let's say I mentioned the database name to be
example then after that what you have to do is you have to create a table inside this particular database to do that you
can just mention the commands create table and then you have to mention the table names over here I'm entering it as
customers and then you have to mention the column names and the required data types right so if you see on my screen
what I had mentioned is basically customer ID it's of int type and then it is primary key so when I say primary key
what I mean by that is you know if the table is unique we identified with this particular
column right and then it should be not null that is basically no null value can be present in this particular table
since it's a primary key and it is Auto incremented after that we also have the customer name so customer name is a Val
cat type that is basically any text till 255 characters now once you're done with that what you have to do is you have the
next create a spring boat project and provide the required details and finally add the JDBC my sequel and web
dependencies to your project now once the project is created you have to configure the database into the
applications properties right so whenever you create a Springwood project you'll see that you know you'll have a
file owners application properties what you have to do is you have to configure your database to that application
properties to do that what you do is you mention the code that you can see on my screen so basically you have to
basically mention that you know springboard datasource you are it is basically my sequel localhost that is
basically you're defining that you know you're connecting it to a my sequel database and then you're mentioning the
username to be root password to be my sequel and then you're enabling the spring dot jp-8 or hibernate DDL to be
create or draw now once this is also done what happens is that if you check your main application or java class
you'll basically have the code that you can see on my screen that you know i've created a package and then I basically
imported the required dependencies and after that I've just created a public class and inside this public class I've
just created a run function now once you check your application or Java class also you have to next create a
controller to handle the HTTP requests by mentioning the code that you can see on my screen again right so basically
over here we have again imported the required annotations like request mapping or 2y or JDBC template and les
controller right now after that I've just used the les controller annotation or two white JDBC and the request
mapping annotation and then over here I've just given this command of insert right so what happens is that whatever
this particular application is executed the data that I mention over here in values is basically inserted into the
table right so for example I've mentioned the customer name to be Aria right so once this application is
executed and then you go to the port localhost colon 8080 slash insert you'll see an output that you know data entry
successful and then you can again go forward and check into your my sequel database whether the data has been
entered or not so I hope guys that you've understood what are the steps to insert data into a my sequel database
and connect the spray good application with the database right now any interviewer won't ask you to sit
and write a code for it well I would just say he would just ask you the common steps or maybe a generalized view
of how you can insert a data to make sure that you know you have an understanding of spring boot or not so
on that note let's look into the next question that is how to enable the HTTP support in springboard well the answer
to this question is really simple you can just enable the HTTP support in spring boot by using this particular
command that you can see on my screen that a server that HTTP 2 dot equal to true so whenever you make it true it is
basically enabled next let's look into the question what are the differences between address requests mapping and ads
ArrayList controller annotation in springboard so the difference is between these two annotations are really simple
guys well the address request mapping annotation is basically used to provide the routing information and tells to
spring that you know any HTTP requests must be mapped to a respective method also to use this annotation you have to
import altered Spring Framework that web dot bind that annotation dot request mapping coming to rest controller 1 this
annotation is basically used to add to the spawns body and controller annotation to the class so if you have
to use this annotation you basically have to import all got spring dot framework dot web let bind that
annotation dot rest controller now if you have to explain you with an example then you can see the example that I've
mentioned on the screen right so I've basically used address controller annotations and the request mapping
annotations so what I've done is in the request mapping one I've mentioned slash example right so when we open our URL
that is basically localhost 8080 slash then we'll see a message that you know return welcome to it Eureka
so what happens is that you know the example method that you can see over here that is the spring example method
is mapped through the example URL with the help of request mapping and rest controllers now moving on to the next
question that is what a spring would CLI and how to execute the spring boot project using boot CLI well spring would
CLI is a tool supported by the official spring framework so the steps to basically execute a spring build project
are basically as you can see on my screen you have to first download the CLI tool from the official web site and
extract the zip file then basically the bin folder present in the spring setup is basically used to execute the spring
boot application after that since spring boots CLI executes groovy files you need to
we file for spring boot application so the door dad you have to open a terminal and change the current directory to a
bin folder and then you can open a groovy file right if you have to start writing an application in springboard
CLI please remember that you know that Springwood CLI supports groovy files so you have to go to the bin folder and
then open a groovy file and then in the groovy file you can mention a controller as you can see on my screen right so
over here as you can see I've mentioned slash example and in h1 I've mentioned welcome to idea Rekha that is basically
what will be shown as output right after that if you just if you want to just execute this groovy file what you'll do
is that you know you mention this command of dot slash spring run and then mention the name of the crew a file so
since I had mentioned it as sample or groovy and mentioned sample or groovy and semicolon so guys that was about
what a spring would CLI and how to execute a spring good project using spring boots here like let's move
forward with the next question that is what are the differences between JPA and hibernate
well this is one of the most common questions that is asked in your spring boot interviews well JPA is basically a
data access abstraction which is used to reduce the amount of boilerplate code coming to hibernate hibernate is an
implementation of the Java persistence API and offers benefit of loose coupling so guys these are the basic differences
between JPA and hibernate so that was about the differences the next question on the list is how can we create a
custom endpoint in Springwood actuator well to create a custom endpoint in spring go to point tag you can basically
use the aggregate endpoint annotation so springboard basically exposes endpoints using a great web endpoint annotation or
at the rate web endpoint extension over HTTP with the help of spring MVC or Jersey let's move forward with the next
question that is what is spring data well spring data aims to make it easy for the developers to use relational and
non-relational databases cloud-based data services and other data access technologies so basically it makes it
easy for data access and still retains the underlying data right so whenever you use spring data remember that you
know you're using it to connect with relational databases non-relational databases and other data access
technologies let's move forward with the next question that is what do you understand by Auto configuration in
springboard and how to disable the auto configuration so as the name suggests Auto configuration is basically
used to automatically configure the required configuration for the application for example if you have a
data source being present in the class path of the application then it automatically configures the JDBC
template alright so with the help of this author configuration you can basically create a java application in a
very easy manner as it automatically configures the required beans and controllers so to disable this auto
configuration property you basically have to exclude the attribute of add that it enable auto
configuration annotation in the scenario where you don't want it to be applied right so what do you have to basically
mention is as you can see on my screen it's added it enable auto configuration and in Bacchus you mention exclude equal
to data source order configuration or class coming to the scenario of the class is not on the class path then you
basically have to exclude the auto configuration by mentioning at the rate enable auto configuration and in
brackets you mention exclude name equal to sample dot class apart from this spring boot also provides the facility
it will exclude the list of Auto configuration classes by using the spring dot Auto configure don't exclude
property so you can go forward and add it either into your application route properties file or add multiple classes
with comma separated so guys that was about order configuration and how you can disable auto configuration is
basically used to automatically configure the required configuration and to disable it you just have to use the
attribute name exclude now let's move forward with the next question that is what are the differences between a great
springboard application and either it enable auto configuration annotation talking about address doing good
application annotation first it is basically used in the main class or the bootstrap class and it is a combination
of added configuration added components can and as RIT enable auto configuration annotations coming to the avid enable
out of configuration annotation it is basically used to enable auto configuration and component scanning in
your project and is a combination of added configuration and component scan annotations so guys these were the
differences between address spring boot application and add that it enable auto configuration annotations now let's move
forward with the next question that is what are the steps to deploy springboard web applications as a jar and bar files
now to deploy springboard web applications you basically have to add a plug-in in the palm dot XML file to add
a plug-in you have to basically mention the code that you can see on my screen that is that you know you have to add
the plug-in tags and then inside the tags you have to add a group ID tags in which you mention org dot Spring
Framework tote board and in the artifact ID you have to mention spring - boo - maven - plugin so basically guys this is
the plugin that you have to include that is basically the spring boot maven plugin now by using the above plugin you
will basically get a jar file which executes the package phase so this jar file will basically contain all the
necessary libraries and dependencies required and it will also contain an embedded server so you can basically run
the application like any other ordinary jar file right so if the packaging element in the form dat XML file must be
sent to a charge to build the jar you'll basically mention packaging tags and you'll mention jar inside that as you
can see on my screen similarly to build a war file you will mention war inside the packaging tags so guys that was
about how to deploy springboard web application as a jar or a word file now let's move forward with the next
question that is can you give an example for read-only as true in the transaction menu well the example for read-only as
true in the transaction management could be as you can see on my screen what you can answer is that you know you can
basically consider the scenario where you have to read data from database right for example let's say you have a
customer database and then you want to read the customer details such as customer ID name and email ID now to do
that what you'll do is you'll basically set read-only on the transaction as we do not want to check the change in the
entities we just want to read the data from the database so in such a scenario you can basically use this read-only as
true in transaction management so whenever you want to use database guys go forward with read-only if you want to
look at the change in the entities and you cannot use this let's move forward with the next question that is can you
explain how to deploy a different server with Spring pool well if to deploy a different server
with spring would you basically have to follow two steps the first step is to generate a war file from the project and
the second step is to basically deploy the war file onto your favorite server now the steps to deploy the war file on
the server is completely dependent on the server you choose right so the main steps to deploy a difference of when the
Springwood is to basically generate the war from the project and then you have to deploy that particular war file onto
your favorite server now deploying it on the favorite server completely depends on server the server pace and there's
not much difference in that but yes it depends so what the server-based now let's look
into the next question that is what is the best way to expose custom application configuration with
springboard now there could be many ways but one way to expose the custom application configuration and
springboard is by using the add great value annotation the only problem with this annotation is that you know all the
configuration values will be distributed throughout the application right now to avoid this you can go forward with the
centralized approach by centralized approach what I mean by that is that you know you can define a configuration
component using the added configuration properties right so and you can define the absolute configuration properties as
you can see in my screen what you can do is you can just use this configuration athlete configuration properties and
then you can mention whatever data that you want to mention for example let's say I mentioned example right and then
I'll initialize few variables like you don't ain't Nam boolean value and string message now according to the previous
code the value is configured in the application properties will be example dot number equal 200 examples are value
equal to true an example what message equal to dynamic message so guys that was about how you can expose a custom
application configuration with springboard you can basically use a centralized approach instead of the a
great value annotation let's move forward with the next question that is can we create an on web application in
springboard well I would say we can definitely create an on web application by removing the web dependencies from
class path along with changing the way Springwood creates the application context right so if you want to create
an on web application what you have to do is you have to basically remove the dependencies from the class path along
with changing the way string boot creates the application context so guys that was about how you can create a non
web application using spring food let's move forward with the next question that is what are the steps to connect an
external database like my sequel or Oracle well to connect an external database you basically have to follow
the steps that you can see on my screen you start by adding the dependency for my sequel connected to the format XML
file and then you have to remove the h2 dependency from the form load XML file after that you have to set up your my
sequel database and then you have to configure your connection to the my sequel database and finally you can just
restart your project so guys these were the steps to connect an external database like MySQL or Oracle
let's move forward with the next question that is mentioned the advantages of Yama file then property
while and the different ways to load the Yama file in spring boo well the advantages of a Yama file than
a properties file is that you know well the data is stored in a hierarchical format so it becomes very easy for the
developers to debug if there's any issue right so the spring application hood class basically supposed the yeah mel
file as an alternative to properties whenever you use the snake Yama library on your crossbar so basic advantage of
Yama file to properties file is that you know it the data is stored in an hierarchical format and it becomes easy
for the developers to debug if there is any error now the different ways to load a Yama file in springboard is basically
by either using the yeah Mel map factory bean to load the yeah Mel as a map or yeah Mel properties factory bean to load
the yeah Mel s properties right so guys these are the basic two ways to which you can load the yamen file in
springboard now let's move forward with the next question that is how is hibernate chosen as the default
implementation for JPA without any configuration well when we use the spring would auto configuration
automatically the spring boot starter data JP dependency gets added to the form data XML file since this dependency
has a transitive dependency on JP a and hibernate spring boat automatically auto configures hibernate as the default
implementation for JP a whenever it sees hibernate in the class bar so guys that is the reason that you know happen it is
chosen as the default implementation for JP let's move forward with the next question that is what do you understand
by spring data rest well as you know already what spring data is spring data rest is basically used to expose the
restful services around spring data repositories right for example let's say you know you consider the example that
you can see on my screen over here I've a repository resource and let's say sample and the path to be sample again
and then it basically extends the customer repository of its sample and then you know it has a few data now to
expose other services you basically have to use the HTTP methods and let's say you know I use the post method so in the
post method what happens is that you know let's say I mention the customer name and customer name email ID so we're
let's say I mentioned Rohith and the customer email ID to be customer one as rate abc.com and now what happens is
that you know in the response content you automatically see that you know the customer name comes to be Rohit
the customer email ID is customer one as read abc.com and then as a local reference to the sample URL
that you are just given so if you observe the response contained then it contains the reference of the newly
created the source right so that's how basically you can use the spring date arrest guys it's basically used exposed
to the school services around the spring data repositories now let's move forward with the next question that is what is
the difference between request mapping and get mapping well the difference is quite simple the get mapping is
basically a composed annotation that acts as a shortcut for request mapping method equal to request method get right
so both these methods basically support the consumes now the consume options that are supported are the text plane
and explain application star so both these consumes are supported by both the request mapping annotation and the get
mapping annotation now let's move forward with the next question that is in which layer should the boundary of
the transaction start well according to me the boundary of the transaction should start from the service layer
since the logic for the persist transaction is present in the layer itself
let's move forward with the next question that is how does the path equal to sample and collection resource
arielle equal to sample work with spring data rest well that is basically what you can see on my screen that is you
know how is the collection the source well equal to sample and path equal to sample work with spring data rest so if
you are just understood in my previous question about spring data at rest the path is basically a section which is
used to mention the segment under which the resource is to be exported and the collection the source is basically the
value which is used to generate links to the collection the source so guys this is the basic difference the pass is
basically used to mention the segment and the Westerner sources to be exported and the collection the source is
basically used to generate the links to the collection resource now let's move forward with the next question that is
explained how to register a custom auto-configuration so in order to register an auto
configuration class you have to mention the fully qualified name under the add the rate enable auto configuration key
meta - INF slash spring factories file right also if you build with the Maven then
this file should be placed in the resources slash method - int directory so that was about how to register a
custom water configuration let's move forward with the next question on how do you configure log4j for logging now
since Spring wood supports log4j - for logging a configuration you have to exclude log back and include log4j - for
locking and this can be only done by using the spring status project so to configure log4j for logging you have to
use the corresponding status project now let's move forward with the next question that is what are the
differences between war and embedded containers well war files basically benefit a considerable measure from the
springboard and embedded containers are only one component of springboard and it's utilized during improvements right
so what is basically used when you want benefit from springboard when you want to package a file is a war file or maybe
you know you are importing a file an embedded containers is basically only one component of Springwood which is
utilized during improvements now let's move forward with the next question that is what your thing is the need for
profiles the profiles in spring basically provides a way to segregate the parts of the application
configurations and makes it available in the environments so basically any accurate component or any accurate
configuration annotation can be marked with added profiles the limit as it is loaded
now for example let's say you know you have multiple environments let's say dev QA stage and prod now let's say you want
to have different application configurations in each of this environment what you can do is you can
use profiles to have different application configurations for each of this environments so if you ask me the
need of profiles then I would say that you know profile is basically used in spring and spring would in such a way
that you know you can determine or you can specify the active profile for a specific environment and the
configuration of the various environments can be set for various profiles right so different environments
can have different kinds of configurations right so that's what what you can do with profiles now let's move
forward with the next question that is what are the steps to add a custom JS code with Springwood now the steps to
add a custom JS code with springboard or as you can see on my screen you first have to create a folder called static
under the resources folder and then in this particular folder you can put the static content so just in case the
processor throws an unauthorized error that you know you're not allowed to do you can either disable the security or
search for the password in the log file and eventually pass it in the request header so the steps to add custom JS
code with Springwood is very simple you have to create a folder called static under the de saucé folder and then in
this particular folder you have to add all the required static contents now let's move forward with the next
question that is how to instruct an author configuration to back off when a beam exists now to instruct an auto
configuration class to back off when a pin exists you have to use the add rate conditional on missing beam annotations
and the attributes for this annotation are basically value and name the value basically stores type of the beans to be
checked and the name basically stores the names of the beans to be checked now let's move forward with the next
question that is why spring date addressed not recommended in real world applications well I would say Spring
Gate arrest is not recommended in real world applications as you're exposing your database entities directly as rest
services so while designing restful services the two most important things that we consider is the domain model and
the consumers right but if you use spring date addressed none of these parameters are considered as we are
exposing our database entities as well as services so I would just say you can use the spring gate address for initial
evolution of the project and then not use it in the further stages now let's move forward
the next question tell us what is the error you see if h2 is not present in the class path well the error that you
see is basically what you can see on my screen it throws an error saying that you know cannot determine embedded
database driver class for database type none not to resolve this type of error you basically have to add the h2
dependency to the format XML file and then you have to restart your server now to add this dependency what you have to
do is you have to mention the code that you can see on my screen that is basically again under the dependency
tags you have to mention the group ID comma dot h2 database and the artefact ID you have to mention h2 and in the
scope you mentioned runtime now I'll talk about the next question that is what is the way to use profiles to
configure the environment specific configuration with spring pool now since it's already a known fact that you know
profile is nothing but a key to identify an environment let's consider two profiles for this example the first
profile is depth the second one is prot now let's say you know the properties that you can see on my screen are
considered in the application or properties files that is example that number to be hundred example dot value
to be through an example dot message to be dynamic message now say you want to customize the application root
properties for the development profile that is a def profile then you need to create a file with the name application
- Tefft or properties and override the properties that you want to customize for example let's say you want to
override the properties of message right so in the example that message you basically assign this value to dynamic
message in tab similarly if you want to customize the application or properties for the prod profile then you again have
to create a file with the name application - prod that properties and override the properties that you want to
customize so again we can just mention example odd message dynamic message in prod once you're done with profile
specific configuration what you have to do is you have to set the active profile in an environment so to do that either
you can use - these spring tour profiles are active equal to prod and arguments or you can use spring dot profiles that
active equal to prod in application blood properties file so guys that was about how you can use profiles to
configure the environment specific configuration with springboard let's move forward with the next question that
is mentioned the dependencies needed to start up a API application and connect in memory database h2 with Springwood
well the dependencies to start a JPA application and connecting memory data-based with h2 in spring boat you
basically need three dependencies that is webstar the h2 and data GOP starter so to include these dependencies you
basically have to include the spring starter projects of all the three that is that you know for web starter you
link root spring boot start a web for its to you'll include calm dot h2 database and then in the artifact ID h2
and for data JP a starter your basically include spring boots starter taylor JPA so these are the basic dependencies that
are required that it's web starter h2 and data GPA starter now let's move forward with the next question that is
what do you understand by spring board supports relaxed binding but the last binding is a way in which the property
name does not need to match the key of the environment property in spring board relaxed binding is applicable to the
types of binding of the configuration properties for example if a property in a beam class with the added
configuration properties annotation is used sample prop then it can be bounded to any of the properties like you know
sample prop sample proper lower case sample prop an upper case sample - proper name in sample - prop an upper
case the basically relaxed binding is basically a way in which the property named it does not have to match the key
of the environment property right so that's what you have to understand that you know when I say spring board
supports relaxed binding now let's move forward with the next question that is where is the database connection
information specified and how does it automatically connect to h2 well the answer to this question is very simple
it is because of the springboard auto configuration property that configures the dependencies of the application so
the database connection information and automatically connecting the database to h2 is completely done by the auto
configuration property now let's move forward with the next question that is what is the name of the default h2
database configured by Springwood but the name of the default h2 database is the test TB so if you check for the
default database name then you'll see that you're the spring dot data source or name equal to test dB now just in
case if you're using h2 in memory database then exactly this is the name of the spring boat which is used to set
up your h2 database also right so that is what basically is guys the name of the default h2 database is test dB now
coming to the final question for today's session that is do you think you can use jetty instead of Tomcat in spring boot
start over I would say yes we can definitely use jetty instead of Tomcat in spring boots
start a web by removing the existing dependencies and then you just have to include the dependency for spring boots
start the jetty so exclude the dependencies that is the existing one you have to use the
exclusions tag that you can see in my screen you can just use the spring would start a web dependency and the jetty
dependency right so guys with this we come to an end of this particular session I hope you found this session
infinitive and I hope all the questions were clear to you so if you have attended any interviews regarding Java
developer or Springwood Java developer and you have any questions please comment them in the comment section and
we'll get back to you as soon as possible until then that's all for my side today I hope you found the session
interesting so thank you and have a great day I hope you have enjoyed listening to
this video please be kind enough to like it and you can comment any of your doubts and queries and we will reply
them at the earliest do look out for more videos in our playlist and subscribe to any Rekha channel to learn
more happy learning
Heads up!
This summary and transcript were automatically generated using AI with the Free YouTube Transcript Summary Tool by LunaNotes.
Generate a summary for freeRelated Summaries

Top 10 Spring Boot Interview Questions with Answers & Examples
Discover the top 10 Spring Boot interview questions with detailed answers and practical examples. This guide covers key concepts like auto-configuration, starters, REST APIs, actuator, exception handling, and profiles to help you ace your Spring Boot interviews.

Top 10 Angular Interview Questions for Beginners and Juniors
Master the top 10 Angular interview questions designed for candidates with 0-2 years experience. Learn key concepts like Angular vs AngularJS, TypeScript advantages, components, modules, data binding, directives, lifecycle hooks, observables, and authentication to confidently crack your interview.

25 Essential Angular Interview Questions with Code Demonstrations
Explore 25 crucial Angular interview questions with detailed answers and code examples. This guide covers Angular basics, architecture, data binding, routing, lazy loading, services, dependency injection, and more to help you excel in your interview.

Java Programming: A Comprehensive Guide to Understanding Java and Its Concepts
Explore Java programming concepts including OOP, exception handling, and collections. Learn how to build robust applications!

The Ultimate Guide to Apache Spark: Concepts, Techniques, and Best Practices for 2025
This comprehensive 6-hour masterclass covers everything you need to know about Apache Spark in 2025, from architecture and transformations to memory management and optimization techniques. Learn how to effectively use Spark for big data processing and prepare for data engineering interviews with practical insights and examples.
Most Viewed Summaries

A Comprehensive Guide to Using Stable Diffusion Forge UI
Explore the Stable Diffusion Forge UI, customizable settings, models, and more to enhance your image generation experience.

Kolonyalismo at Imperyalismo: Ang Kasaysayan ng Pagsakop sa Pilipinas
Tuklasin ang kasaysayan ng kolonyalismo at imperyalismo sa Pilipinas sa pamamagitan ni Ferdinand Magellan.

Mastering Inpainting with Stable Diffusion: Fix Mistakes and Enhance Your Images
Learn to fix mistakes and enhance images with Stable Diffusion's inpainting features effectively.

Pag-unawa sa Denotasyon at Konotasyon sa Filipino 4
Alamin ang kahulugan ng denotasyon at konotasyon sa Filipino 4 kasama ang mga halimbawa at pagsasanay.

How to Use ChatGPT to Summarize YouTube Videos Efficiently
Learn how to summarize YouTube videos with ChatGPT in just a few simple steps.