wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

spring boot 測驗

Total questions: 15

Worksheet time: 14mins

Name
Class
Date
1.

Spring Boot 如何幫助簡化應用程式的開發流程?

a)

限定使用外部伺服器來運行應用

b)

仰賴開發者手動編輯大量的 XML 配置文件

c)

提供自動配置、內嵌伺服器,並減少樣板代碼

d)

支持微服務架構,但不提供監控和健康檢查的功能

2.

Spring Boot 中,@SpringBootApplication 注解等效於哪三個注解的組合?

a)

@Configuration, @EnableAutoConfiguration, @ComponentScan

b)

@RestController, @EnableAutoConfiguration, @ComponentScan

c)

@Controller, @Service, @Component

d)

@Repository, @Controller, @Service

3.

IoC 的全稱為 ___a___,IoC 的意思為 ___b___

a)
Inversion of Control(控制反轉)
b)

Immediate or Cancel(立即成交或取消)

c)

將 Object 的控制權,交給外部的 Spring 容器來管理

d)

將 Object 的控制權,留下來自己管理

4.

創建 Bean 的方法有哪些?

a)

使用 @Configuration + @Bean

b)

使用 @PostConstruct

c)

使用 @Autowired

d)

使用 @Component

5.

初始化 Bean 的方法有哪些?

a)

使用 @Component

b)

使用 @Autowired

c)

使用 @PostConstruct

d)

實現 InitializingBean interface 的 afterPropertiesSet() 方法

6.

AOP 的全稱為 ​ ___a___ ,AOP 的意思為 ___b___

a)

Automatic Operation(自動運轉機制)

b)
Aspect-Oriented Programming(切面導向程式設計)
c)
將共同邏輯寫在切面裡,由切面統一去做處理
d)

將共同邏輯複製到所有方法裡面,讓每一個方法自己去處理

7.

@Aspect 的用途為?

a)

將 Class 變成由 Spring 容器所管理的 Bean,並自動注入依賴

b)

表示這個 Class 是用來設定 Spring 的 Java Config

c)

用於在 Spring MVC 中定義一個 Controller,處理 HTTP 請求

d)

宣告這個 Class 是一個切面

8.

下列哪一個「不是」 Spring AOP 常見的應用?

a)

Log 記錄

b)

權限驗證

c)

管理 Spring 容器

d)

統一的 Exception 處理

9.

@RequestMapping 的主要用途為?

a)

將 Class 變成由 Spring 容器所管理的 Bean

b)

將 url 路徑對應到方法上

c)

讀取 Spring Boot 設定檔(application.properties)中指定的 key 的值

d)

將 HTTP 請求的參數自動綁定到方法的參數上

10.

下列哪一個「不是」設計出 RESTful API,需要同時滿足的三大要素?

a)

在 request header 中帶上 Authorization header,用作身份驗證

b)

使用 http method 表示動作

c)

使用 url 路徑描述資源之間的階層關係

d)

response body 返回 json 或是 xml 格式

11.

若想要在加上「@RequestBody」的 student 參數裡面,使用 @NotNull... 這類的驗證請求參數的註解的話,則需要在 student 參數前面加上 (a)  

12.

若想要在加上「@PathVariable、@RequestParam、@RequestHeader」的參數上,使用 @NotNull... 這類的驗證請求參數的註解的話,則需要在這個 Class 上加上 ______?

a)

@Valid

b)

@Valided

c)

@Validated

d)

@Validation

13.

@ControllerAdvice 的底層是使用 Spring IoC 實作的,所以才能夠統一的去管理所有 Controller 所噴出的 Exception ?

a)

正確

b)

錯誤

14.

攔截器 Interceptor 的前置處理功能為?

a)

統一管理 Controller 所拋出的 Exception 並返回統一的錯誤響應

b)

根據 HTTP request 的類型(如 GET、POST)動態選擇對應的 Controller 方法執行

c)

改變 Controller 方法執行完畢後的返回結果,修改 response 的內容

d)

決定要不要允許這次的 HTTP request 通過,進到 Controller 裡去執行對應的方法

15.

以下關於 HandlerInterceptor 的 preHandle 方法描述何者錯誤?

a)

preHandle 方法返回 false,表示「拒絕」 這次 http request 通過

b)

preHandle 方法返回 true,表示「允許」這次 http request 通過

c)

preHandle 方法將在 controller 處理之前進行調用

d)

preHandle 方法可用來修改 HTTP request 的 body 內容,並影響後續 Controller 的處理