Spring boot Interview Questions
The article discusses common Spring Boot interview questions, focusing on CORS and CSRF. It explains the importance of CORS for secure API access between different domains and how to configure it in Spring Boot. Additionally, it defines CSRF attacks and their implications for web security.
- ▪CORS is a browser security mechanism that allows or restricts APIs from being accessed by another domain.
- ▪In Spring Boot, CORS can be configured using the @CrossOrigin annotation or through global configuration.
- ▪CSRF attacks trick authenticated users into sending unauthorized requests to applications they are logged into.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3937692) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Poojitha Posted on May 22 Spring boot Interview Questions #career #interview #java #springboot 1. What is CORS and why is it required? CORS (Cross-Origin Resource Sharing) is a browser security mechanism that allows/restricts APIs from being accessed by another domain. Example: Frontend: http://localhost:3000 Backend API: http://localhost:8080 These are different origins because ports are different. Without CORS configuration, browser blocks the request.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).