Consider kotlin controller class:
@RestController
@RequestMapping("/myPath/")
open class MyController {
private val s3AsyncClient: S3AsyncClient = S3AsyncClient.builder().build()
//...
@PostMapping("/indexing")
@Secured("ROLE_USER")
fun someFunction() {
return s3AsyncClient.toString();
}
}
Which leads to NullPointerException.
Here is what I saws in debugger:
But when @Secured
is removed everything works. So it seems that spring security proxing breaks kotlin val initialization. is there a way to make them works all together?