单选题 在 Spring Boot 中,哪个注解用于标记一个类为 RESTful Web 服务控制器,并且其方法返回值直接写入 HTTP 响应体?(中)(4分)

A、 @Controller
B、 @Service
C、 @RestController
D、 @Repository
下载APP答题
由4l***1i提供 分享 举报 纠错

相关试题

单选题 在 Spring Boot 中,如何在一个控制器方法中同时接收和返回 JSON 数据?(中)(4分)

A、 使用 @RequestBody 接收数据,@ResponseBody 返回数据
B、 使用 @RestController 即可,无需其他注解
C、 使用 @RequestMapping 同时处理输入输出
D、 使用 @RequestParam 接收数据,@ResponseBody 返回数据

单选题 使用 Thymeleaf 时,如何遍历一个集合并在页面上显示每个元素?(中)(4分)

A、 th:for="item : ${items}"
B、 th:foreach="item : ${items}"
C、 th:each="item : ${items}"
D、 th:loop="item : ${items}"

单选题 如果希望在 Spring Boot 应用中返回一个视图名称而非直接写入 HTTP 响应体,应该避免使用哪个注解?(中)(4分)

A、 @Controller
B、 @RestController
C、 @RequestMapping
D、 @ResponseBody

单选题 在 Thymeleaf 中,如果你想在一个模板中包含另一个模板的部分内容,应该使用哪种语法?(中)(4分)

A、 @{template :: fragment}
B、 #{template :: fragment}
C、 ~{template :: fragment}
D、 ${template :: fragment}

单选题 在 Thymeleaf 模板中,如果需要根据变量值显示不同的内容,应该使用哪个属性?(中)(4分)

A、 th:if
B、 th:switch
C、 th:case
D、 th:each

单选题 在 Thymeleaf 中,如何使用工具对象对字符串进行操作,比如检查字符串是否以特定前缀开始?(中)(4分)

A、 ${#strings.startsWith("text", "pre")}
B、 ${#strings.startWith("text", "pre")}
C、 ${#strings.prefix("text", "pre")}
D、 ${#strings.beginsWith("text", "pre")}

单选题 如果要在 Thymeleaf 模板中设置一个临时变量,并在其作用范围内使用该变量,应该使用哪个属性?(中)(4分)

A、 th:var
B、 th:with
C、 th:set
D、 th:assign

单选题 若想在 Spring Boot 中通过 GET 请求传递多个查询参数给控制器方法,应该使用哪个注解?(中)(4分)

A、 @RequestBody
B、 @RequestParam
C、 @PathVariable
D、 @RequestHeader