R4RIN
Articles
Java 8
MCQS
Spring Boot MCQ Quiz Hub
Spring Boot - CORS
Choose a topic to test your knowledge and improve your Spring Boot skills
1. Full name of CORS?
Cross-Origin Resource Sharing (CORS)
Cross-Origin Resource and Servers
Cross-Origin Resource and Services
None
2. CORS is a security concept that allows restricting the resources implemented in web browsers
true
flase
3. Choose correct for CORS
CORS prevents the JavaScript code producing or consuming the requests against different origin
CORS is a security concept that allows restricting the resources implemented in web browsers.
Both
Only 1
4. @CrossOrigin annotation supports specific REST API
true
false
5. @CrossOrigin annotation supports specific REST API, and not for the entire application.
Yes
No
6. Enable CORS in Controller Method
@RequestMapping(value = "/products") @CrossOrigin(origins = "http://localhost:8080") public ResponseEntity<Object> getProduct() { return null; }
@RequestMapping(value = "/products") @CrossCORSOrigin(origins = "http://localhost:8080") public ResponseEntity<Object> getProduct() { return null; }
Both
None
7. CORS Configuration can be Globally?
Yes
No
8. @Bean configuration to set the CORS configuration support globally to your Spring Boot application.
true
flase
9. @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/products").allowedOrigins("http://localhost:9000"); } }; }
Syntax to set the CORS configuration support globally to your Spring Boot application.
Syntax to set the CORS configuration support specific REST API .
Both
None
Submit