ADP Assignment 4
ADP Assignment 4
(CSE4171)
Assignment - 4
Topic: SpringBoot Starter, SpringBoot Starter
Dependencies and Auto Configuration, Annotation-Based
Java Configuration, Xml-Based Configuration, Loosely
Coupled Dependency Injection
________________________________________________________________________________
1
5. Write POJO Java program to convert tightly coupled code into loosely
coupled code
a. Create a parent class A with a method display(). Create another
class B that inherits class A and contains a method display().
Create a main class to call the display method.
b. Create a class LightBulb with a method SwitchOn(). Create
another class Switch that has an object of the LightBulb class
and another method Operate(). Inside the Operate() method
call the SwitchOn() method
6. Write a simple SpringBoot Project and add the Spring Web and
Spring Boot Dev Tools dependencies. Execute the application.
7. Write a SpringBoot Program with the following:
a. Create an Employee class with two instance variables, name
and age.
b. Add a parameterized constructor to set the data.
c. Add an overridden toString() method to print the details.
8. How does Spring Boot use @ConditionalOnClass to trigger
auto-configuration?
9. Explain the role of @ConditionalOnProperty in controlling
auto-configuration behavior.
10. What is the significance of @ConditionalOnBean in Spring
Boot’s auto-configuration process?
11. What is the purpose of the spring-boot-starter-parent in a
Spring Boot application, and how do we dive deeper into the structure
of any dependency used within the project?