0% found this document useful (0 votes)
6 views4 pages

ADP Important Questions and Answers

The document outlines important questions and answers related to Spring Boot, including its advantages, features, and differences from the Spring framework. It discusses concepts such as microservices, dependency injection, and various annotations, along with tools required for development. Additionally, it covers Maven, Spring Initializr, and the significance of the pom.xml file in managing project dependencies and configurations.

Uploaded by

sharma2aditi.24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

ADP Important Questions and Answers

The document outlines important questions and answers related to Spring Boot, including its advantages, features, and differences from the Spring framework. It discusses concepts such as microservices, dependency injection, and various annotations, along with tools required for development. Additionally, it covers Maven, Spring Initializr, and the significance of the pom.xml file in managing project dependencies and configurations.

Uploaded by

sharma2aditi.24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ADP Important Questions and Answers

1:- Advantages of Spring Boot: Spring Boot simplifies development with embedded
servers, auto-configuration, reduced boilerplate code, and production-ready features
like metrics and monitoring.

2:- Features of Spring Boot framework: Key features include auto-configuration,


embedded servers (Tomcat, Jetty), production-ready tools, and Spring CLI for
Groovy-based scripts.

3:- Difference between loosely coupled and tightly coupled system: Loosely
coupled systems allow components to operate independently and be replaced without
significant changes, while tightly coupled systems have interdependent components
that require simultaneous changes.

4:- Discuss the advantages of microservices: Microservices enable independent


deployment, scalability, technology diversity, fault isolation, and faster development
cycles.

5:- List the tools required to develop Spring Boot applications: Required tools
include IDE (IntelliJ IDEA, Eclipse), Maven/Gradle, JDK, and optionally, Docker,
Postman, and a version control system like Git.

6:- Define Maven and explain its advantages: Maven is a build automation tool for
Java projects that manages dependencies, builds, and provides project management
tools.

7:- Define Spring Initializr and list its steps to create a Spring Boot application:
Spring Initializr is a web-based tool to create Spring Boot projects. Steps include
selecting project settings (language, dependencies, etc.) and generating a project.

8:- What do you mean by minimal value production?: This could mean delivering a
minimum viable product (MVP) or a basic functional application that provides value to
users early on.

9:- Define Spring Boot Starter: Spring Boot Starters are dependency descriptors that
bundle commonly used libraries for specific functionalities, such as
spring-boot-starter-web for web applications.
10:- Spring Boot Starter Web, Spring Boot Starter JPA, and Spring Boot Starter
Actuator: These starters add dependencies for web (REST), JPA (database), and
actuator (monitoring) functionalities, respectively.

11:- Disadvantages of Dev tools: Development tools may increase complexity,


resource usage, and project dependencies. Some tools may also introduce a learning
curve.

12:- What do you mean by auto-configuration?: Auto-configuration in Spring Boot


automatically configures beans based on dependencies and settings, reducing the need
for manual configuration.

13:- List different types of conditional auto-configuration: Examples include


@ConditionalOnClass, @ConditionalOnMissingBean, and @ConditionalOnProperty,
used to enable configuration only when specific conditions are met.

14:- How to change the port number of an embedded server in Spring Boot: Set
server.port in application.properties (e.g., server.port=8081).

15:- Give a suitable example to define dependency injection: Dependency injection


allows injecting dependencies, such as a DatabaseService instance, into a UserService
class to decouple components.

16:- Differentiate between constructor and setter injection: Constructor injection


requires dependencies at instantiation, while setter injection provides optional
dependencies through setters.

17:- Why field injection is discouraged?: Field injection can make testing and
maintaining code more difficult, as dependencies are not injected through constructors,
making them less visible and harder to mock.

18:- Give an example to create a custom configuration annotation: Define a


custom annotation, like @EnableMyFeature, to encapsulate configuration, then use
@Import to register necessary beans.

19:- Define lazy initialization & how it affects the bean initialization: Lazy
initialization delays the creation of beans until they are first needed, reducing startup
time.
20:- Suitable example of the use of autowired annotation to inject dependency:
@Autowired can be used to inject a service, like @Autowired private UserService
userService;, to use within a controller.

21:- Explain with a suitable diagram, bean life cycle: The Spring Bean lifecycle
involves instantiation, dependency injection, initialization, post-processing, and
destruction.

22:- Explain post-construct annotation with a suitable example: @PostConstruct


marks a method to execute after dependency injection, useful for initialization tasks
(e.g., @PostConstruct void init() {}).

23:- Briefly explain Spring Boot entry class: The entry class contains the main
method annotated with @SpringBootApplication and is the starting point for Spring Boot
applications.

24:- Discuss the following annotations:


• @Autowired: Injects dependencies automatically.
• @Component: Marks a class as a Spring bean.
• @RequestMapping: Maps HTTP requests to handler methods.
• @Service: Marks a service-layer component.
• @Repository: Marks a data-access-layer component.
• @Controller and @RestController: @Controller handles web requests, while
@RestController combines @Controller and @ResponseBody for RESTful APIs.

● @Component Scan: Automatically detects and registers Spring-managed


components.
● @Bean: Defines and manages Spring's application context objects.
● @Get Mapping: Maps HTTP GET requests to handler methods.

25:- Difference between Spring boot framework and Spring framework: The Spring
Framework is a comprehensive framework for Java applications, offering extensive
configurations. Spring Boot builds on Spring, simplifying development by providing
pre-configured setups, embedded servers, and reduced boilerplate, enabling faster
deployment of Spring-based applications.

26. Discuss the importance of pom.xml file: The pom.xml file in Maven projects is
crucial as it manages dependencies, configurations, and plugins. It ensures build
automation, specifies project metadata, and resolves library conflicts, streamlining
project setup and maintenance in Java development.

You might also like