Angular SpringBoot Viva Questions
Angular SpringBoot Viva Questions
Entity classes represent database tables. For example, in my project, Product or User classes are
2. How does your Angular frontend communicate with your Spring Boot backend?
I use Angular's HttpClient service to make HTTP calls (GET, POST, PUT, DELETE) to backend
3. What is a Repository in Spring Boot and how did you use it?
Repository extends JpaRepository and provides built-in methods like save(), findAll(), deleteById(). I
@Autowired automatically injects required classes (like services or repositories) into controllers, so
I used *ngFor to loop through the list of products or users and dynamically display them in the
dashboard page.
Backend: Spring Boot controller method handles the request, uses Repository to save or modify
@CrossOrigin allows my Angular frontend (running on localhost:4200) to access the backend APIs
(running on localhost:8080). Without it, browser CORS policy would block the request.
I use Angular's RouterModule and define routes like /dashboard, /login, /profile inside
app-routing.module.ts to navigate between different pages.
10. If you had to deploy your project, how would you do it?
I would:
- Host the Spring Boot backend (possibly on a server like AWS EC2, Azure, or a local server).
- Serve the frontend using Nginx or include it inside the Spring Boot project using resources/static
folder.
Yes, I faced issues like CORS errors, version mismatch of Node.js during Angular setup, and
backend API connectivity. I solved them by using @CrossOrigin and proper HttpClient integration.