What is the role of the ApplicationContext in Spring?
The ApplicationContext is the central interface for configuring and managing a Spring application. Its key roles are:
Clean Architecture emphasises framework independence. Given that Spring Boot is a framework, how can we still apply Clean Architecture principles effectively?
Keep Spring at the edges, not in your core.
Structure:
Domain layer – Pure Java classes (entities, business rules). No Spring annotations.
Application layer – Use cases depending only on interfaces and domain objects.
Infrastructure layer – Spring lives here: controllers, @Repository implementations, config.
Key technique: Define interfaces in the inner layers, implement them with Spring in the outer layer.
domain/ → Order.java, OrderRepository (interface)
infrastructure/ → JpaOrderRepository.java (@Repository)
Your business logic stays framework-agnostic and testable. Spring becomes a replaceable plugin rather than the foundation.
Explain the role of the Model in the MVC framework
Explain the role of the View in the MVC framework
Explain the role of the controller in the MVC framework
Explain the flow and benefit of the MVC framework
User -> Controller -> Model -> Controller -> View -> User
Given the following diagram of the Spring Boot flow architecture, explain briefly the meaning of the following terms and how they are implemented in Spring Boot: Repository class
Repository class
@Repository
public interface StudentRepository extends JpaRespository<Student, Long>{
Optional<Student> findByEmail(String email);
}</Student>
Given the following diagram of the Spring Boot flow architecture, explain briefly the meaning of the following terms and how they are implemented in Spring Boot: CRUD Services
CRUD Services
```java
repository.save(student);
repository.findById(id);
repository.findAll();
repository.deleteById(id);
~~~
Given the following diagram of the Spring Boot flow architecture, explain briefly the meaning of the following terms and how they are implemented in Spring Boot: Dependency injection and ApplicationContext
```java
@Service
public class StudentService{
private final StudentRepository repository; // Dependency
@Autowired // Spring injects the repository
public StudentService(StudentRepository repository){
this.repository = repository;
} } ~~~Given the following diagram of the Spring Boot flow architecture, explain briefly the meaning of the following terms and how they are implemented in Spring Boot: Service layer
```java
@Service
public class StudentService{
private final StudentRepository repository;
public Student registerStudent(String name, String email){
if(repository.findByEmail(email).isPresent()){
throw new IllegalArgumentException("Email exists");
}
return repository.save(new Student(name,email));
} } ~~~