0
在下面的控制器代碼片段中,當試圖訪問springSecurityService.currentUser時,我得到一個空指針異常。我希望def springSecurityService自動注入服務,我錯過了什麼?注入springSecurityService不起作用
@Transactional(readOnly = true)
@Secured('ROLE_USER')
class TaskController {
static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
def index(Integer max) {
params.max = Math.min(max ?: 10, 100)
def springSecurityService
def user = springSecurityService.currentUser