Q. Which annotation sets a base path for controller mappings?
@RequestMapping
@RestController
@Controller
@ResponseStatus
Q. Which snippet shows correct @PathVariable usage?
@GetMapping("/hello/{name}")
public String hello(@PathVariable String name) {
return "Hello, " + name + "!";
}
@GetMapping("/hello/{name}")
public String hello(@RequestParam String name) {
return "Hello, " + name + "!";
}
@GetMapping("/hello")
public String hello(@PathVariable String name) {
return "Hello, " + name + "!";
}
@GetMapping("/hello")
public String hello(@RequestParam String name) {
return "Hello, " + name + "!";
}
Q. Which annotation serializes a handler result into the response body?
@ResponseBody
@RequestMapping
@RestController
@ResponseStatus
Q. Which annotation registers an exception handler method?
@ExceptionHandler
@ResponseStatus
@RequestBody
@ResponseBody
Q. Which annotation sets a custom HTTP status for a handler?
@ResponseBody
@RequestMapping
@ResponseStatus
@RestController
Q. Which snippet correctly uses @RequestBody?
@PostMapping("/hello")
public String hello(@RequestBody String body) {
return "Hello, " + body + "!";
}
@GetMapping("/hello")
public String hello(@RequestParam String name) {
return "Hello, " + name + "!";
}
@PostMapping("/hello")
public String hello(@PathParam String name) {
return "Hello, " + name + "!";
}
@GetMapping("/hello")
public String hello(@RequestBody String body) {
return "Hello, " + body + "!";
}
Q. Which annotation lets you declare the HTTP verb for a handler?
@RequestMapping
@ResponseBody
@Controller
@RequestMethod
Q. Which annotation defines a shared base URL for controller methods?
@RequestMapping
@ResponseBody
@RestController
@Controller
Popular Posts
1Z0-830 Java SE 21 Developer Certification
Azure AI Foundry Hello World
Azure AI Agent Hello World
Foundry vs Hub Projects
Build Agents with SDK
Bing Web Search Agent
Function Calling Agent
Spring Boot + Azure Key Vault Hello World Example
Spring Boot + Elasticsearch + Azure Key Vault Example
Spring Boot Azure AD (Entra ID) OAuth 2.0 Authentication
Deploy Spring Boot App to Azure App Service
Secure Azure App Service using Azure API Management
Deploy Spring Boot JAR to Azure App Service
Deploy Spring Boot + MySQL to Azure App Service
Spring Boot + Azure Managed Identity Example
Secure Spring Boot Azure Web App with Managed Identity + App Registration
Elasticsearch 8 Security - Integrate Azure AD OIDC