Top 100 Spring Boot Interview Questions and Answers
Updated 10 Dec 2024
Q101. Sterio type annotations in spring boot?
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.
Q102. 1 - where is bean annotation used in springboot ?... In class or method
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
Q103. different frameworks like spring springboot
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
Q104. disadvantage of spring boot
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.
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 moreThe 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
Q106. Major differences between spring and spring boot
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
Q107. Which spring boot version are you using in your project and what are the features in it
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.
Q108. Spring-Boot Use
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
Spring Boot Jobs
Q109. Dependency Injection in Spring Boot
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
Q110. spting vs springboot
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
Q111. Spring Boot overview
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.
Q112. Tells about Spring boot
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
Q113. Spring vs springboot with examples
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
Q114. bean scopes in Spring boot
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
Q115. Profiles in spring boot
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
Q116. Spring vs spring boot framework
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
Q117. Different annotations used in the springboot @Qualifier @Transactional etc
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
Q118. annotations of springbbot
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.
Q119. Annotations of spring boot
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
Q120. Spring Boot and its
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
Top Interview Questions for Related Skills
Interview Questions of Spring Boot Related Designations
Interview experiences of popular companies
Reviews
Interviews
Salaries
Users/Month