Top 100 Spring Boot Interview Questions and Answers

Updated 10 Dec 2024

Q101. Sterio type annotations in spring boot?

Ans.

Stereotype annotations in Spring Boot are used to define custom annotations for specific use cases.

  • Stereotype annotations are used to group related components and simplify configuration.

  • Examples include @Controller, @Service, and @Repository.

  • Custom stereotype annotations can be created using @Component and @Stereotype.

  • Stereotype annotations can be used with other Spring annotations like @Autowired and @Qualifier.

Add your answer
right arrow

Q102. 1 - where is bean annotation used in springboot ?... In class or method

Ans.

Bean annotation is used in Spring Boot on class or method to indicate that a method produces a bean to be managed by the Spring container.

  • Bean annotation is used on methods within a class to indicate that the method produces a bean to be managed by the Spring container.

  • It can also be used at the class level to indicate that the class itself is a Spring bean.

  • For example, @Bean annotation can be used on a method that creates and returns a DataSource bean in a configuration clas...read more

Add your answer
right arrow

Q103. different frameworks like spring springboot

Ans.

Spring and Spring Boot are popular Java frameworks used for building enterprise applications.

  • Spring is a comprehensive framework that provides support for various functionalities like dependency injection, aspect-oriented programming, and transaction management.

  • Spring Boot is an opinionated framework built on top of Spring, which simplifies the setup and configuration of Spring applications by providing defaults for common configurations.

  • Spring Boot includes embedded servers ...read more

Add your answer
right arrow

Q104. disadvantage of spring boot

Ans.

One disadvantage of Spring Boot is its potential for increased memory consumption.

  • Spring Boot can consume more memory compared to traditional Java EE applications due to its auto-configuration and embedded server features.

  • This can lead to higher resource usage and potentially slower performance.

  • Developers need to be mindful of optimizing memory usage and monitoring application performance.

  • Using Spring Boot for small, simple applications may result in unnecessary overhead.

Add your answer
right arrow
Frequently asked in
Are these interview questions helpful?

Q105. What is default server in springboot application? And how can we configure Other server? HashSet set = new HashSet(); for(int i=0; i<100; i++){ set.add(i); set.remove(i-1); } sop(set.size()); What is the o/p of...

read more
Ans.

The default server in a Spring Boot application is Tomcat. Other servers can be configured by adding dependencies and modifying the configuration.

  • The default server in Spring Boot is Tomcat, but other servers like Jetty or Undertow can be used.

  • To configure a different server, you need to exclude the default server dependency and add the desired server dependency in the pom.xml file.

  • You also need to modify the application.properties or application.yml file to specify the serve...read more

Add your answer
right arrow

Q106. Major differences between spring and spring boot

Ans.

Spring is a framework for building Java applications, while Spring Boot is an extension that simplifies the setup and development process.

  • Spring is a comprehensive framework that provides various modules for different functionalities like Spring MVC, Spring Security, etc.

  • Spring Boot is an opinionated framework that simplifies the setup and development process by providing defaults for configuration.

  • Spring Boot includes embedded servers like Tomcat, Jetty, or Undertow, making ...read more

View 1 answer
right arrow
Frequently asked in
Share interview questions and help millions of jobseekers 🌟

Q107. Which spring boot version are you using in your project and what are the features in it

Ans.

We are using Spring Boot version 2.5.2 in our project, which includes features like improved startup performance, enhanced actuator endpoints, and updated dependencies.

  • Spring Boot 2.5.2 offers improved startup performance compared to previous versions.

  • Enhanced actuator endpoints provide better monitoring and management capabilities.

  • Updated dependencies ensure compatibility with the latest libraries and frameworks.

Add your answer
right arrow

Q108. Spring-Boot Use

Ans.

Spring Boot is a framework that simplifies the development of Java applications by providing pre-configured settings and dependencies.

  • Spring Boot is built on top of the Spring framework and follows the convention over configuration principle.

  • It provides a standalone executable JAR file that includes an embedded server, making it easy to deploy and run applications.

  • Spring Boot offers auto-configuration, which automatically configures the application based on the dependencies p...read more

View 1 answer
right arrow
Frequently asked in

Spring Boot Jobs

Java Developer (Database) 5-8 years
A.P. Moller Maersk
4.2
₹ 20 L/yr - ₹ 28 L/yr
Bangalore / Bengaluru
Software Development Engineer 3-8 years
A.P. Moller Maersk
4.2
₹ 20 L/yr - ₹ 33 L/yr
Bangalore / Bengaluru
Embedded Java Architect 8-10 years
TekWissen
4.8
Kolkata

Q109. Dependency Injection in Spring Boot

Ans.

Dependency Injection in Spring Boot allows for loosely coupled components by injecting dependencies at runtime.

  • Dependency Injection is a design pattern where objects are passed their dependencies rather than creating them internally.

  • In Spring Boot, dependencies are injected using @Autowired annotation.

  • By using Dependency Injection, components can be easily swapped out and tested independently.

  • Example: @Autowired private UserService userService; // Injecting UserService depend...read more

Add your answer
right arrow

Q110. spting vs springboot

Ans.

Spring is a framework for building Java applications, while Spring Boot is a tool for quickly creating stand-alone Spring-based applications.

  • Spring is a comprehensive framework for building Java applications, providing support for various modules like Spring MVC, Spring Data, and Spring Security.

  • Spring Boot is an opinionated tool that simplifies the setup and configuration of Spring applications, allowing developers to quickly create stand-alone, production-ready applications...read more

Add your answer
right arrow
Frequently asked in

Q111. Spring Boot overview

Ans.

Spring Boot is a framework for building standalone, production-grade Spring-based applications.

  • Spring Boot simplifies the process of creating and deploying Spring-based applications.

  • It provides a range of features such as auto-configuration, embedded servers, and production-ready metrics.

  • Spring Boot is highly customizable and can be used with a variety of other Spring projects and libraries.

Add your answer
right arrow
Frequently asked in

Q112. Tells about Spring boot

Ans.

Spring Boot is a framework that simplifies the development of Java applications by providing pre-configured settings and tools.

  • Spring Boot eliminates the need for manual configuration by providing defaults for most settings.

  • It allows for the creation of stand-alone, production-grade Spring-based applications.

  • Spring Boot includes embedded servers like Tomcat, Jetty, or Undertow, making it easy to deploy applications.

  • It offers a wide range of plugins and extensions for addition...read more

Add your answer
right arrow

Q113. Spring vs springboot with examples

Ans.

Spring is a framework for building Java applications, while Spring Boot is a tool for simplifying the setup and development of Spring applications.

  • Spring provides a comprehensive framework for building Java applications, including features like dependency injection, aspect-oriented programming, and more.

  • Spring Boot is a tool that simplifies the setup and development of Spring applications by providing defaults for configuration and reducing the amount of boilerplate code need...read more

Add your answer
right arrow

Q114. bean scopes in Spring boot

Ans.

Bean scopes in Spring Boot determine the lifecycle and visibility of beans.

  • Singleton scope: Default scope, only one instance per Spring container

  • Prototype scope: New instance created each time bean is requested

  • Request scope: Bean created once per HTTP request

  • Session scope: Bean created once per HTTP session

  • Application scope: Bean created once per ServletContext

Add your answer
right arrow

Q115. Profiles in spring boot

Ans.

Profiles in Spring Boot allow you to define different configurations for different environments.

  • Profiles help in managing configurations for different environments like development, testing, production, etc.

  • You can define profiles in application.properties or application.yml using 'spring.profiles.active' property.

  • Profiles can be activated using command line arguments, environment variables, or servlet context parameters.

  • Example: 'spring.profiles.active=dev' will activate the...read more

Add your answer
right arrow

Q116. Spring vs spring boot framework

Ans.

Spring is a framework that provides comprehensive infrastructure support, while Spring Boot is a tool that simplifies Spring application development.

  • Spring is a comprehensive framework that provides various modules for different functionalities like Spring MVC, Spring Security, Spring Data, etc.

  • Spring Boot is a tool that simplifies the setup and configuration of Spring applications by providing defaults and auto-configuration.

  • Spring Boot reduces the need for manual configurat...read more

Add your answer
right arrow
Frequently asked in

Q117. Different annotations used in the springboot @Qualifier @Transactional etc

Ans.

Annotations like @Qualifier and @Transactional are used in Spring Boot for dependency injection and transaction management.

  • Annotations like @Qualifier are used to specify which bean to inject when multiple beans of the same type are present.

  • Annotations like @Transactional are used to mark a method as transactional, allowing for rollback in case of exceptions.

  • Annotations like @Component, @Service, @Repository are used for component scanning and auto-wiring.

  • Annotations like @Re...read more

Add your answer
right arrow

Q118. annotations of springbbot

Ans.

Annotations in Spring Boot are used to provide metadata about the application and its components.

  • Annotations are used to configure Spring Boot applications, define beans, handle requests, etc.

  • Examples of annotations in Spring Boot include @SpringBootApplication, @RestController, @Autowired, @RequestMapping, etc.

Add your answer
right arrow
Frequently asked in

Q119. Annotations of spring boot

Ans.

Annotations in Spring Boot are used to simplify the configuration and development of Spring applications.

  • Annotations are used to define the behavior of Spring components, such as controllers, services, and repositories.

  • Annotations like @RestController, @Service, and @Repository are commonly used in Spring Boot applications.

  • Annotations can also be used for mapping requests to controller methods, handling exceptions, and defining transaction boundaries.

  • Annotations like @Autowir...read more

Add your answer
right arrow
Frequently asked in

Q120. Spring Boot and its

Ans.

Spring Boot is a framework that simplifies the development of Java applications by providing pre-configured settings and tools.

  • Spring Boot eliminates the need for manual configuration by providing defaults for most settings.

  • It allows developers to create stand-alone, production-grade Spring-based Applications.

  • Spring Boot includes embedded servers like Tomcat, Jetty, or Undertow, making it easy to deploy applications.

  • It offers a wide range of plugins and extensions for various...read more

Add your answer
right arrow
Previous
1
2
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.4k Interviews
3.8
 • 8.1k Interviews
3.6
 • 7.5k Interviews
3.7
 • 5.6k Interviews
3.7
 • 5.6k Interviews
3.7
 • 4.8k Interviews
3.5
 • 3.8k Interviews
4.0
 • 2.3k Interviews
3.4
 • 1.1k Interviews
4.0
 • 482 Interviews
View all
Recently Viewed
JOBS
Capgemini
No Jobs
JOBS
Swiggy
No Jobs
REVIEWS
Cognizant
No Reviews
JOBS
Red Hat
No Jobs
REVIEWS
CGI Group
No Reviews
REVIEWS
Capgemini
No Reviews
REVIEWS
Cognizant
No Reviews
REVIEWS
Wipro
No Reviews
Spring Boot Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter