Fixing code

Report a typo

In order to implement some new features, you need to have access to a UserDetails object in a controller. The code below is what you need but it contains some mistakes. There are several ways to fix the code. Select all of them.

Java
@GetMapping("feature")
public void feature(UserDetails obj){
     UserDetails details = (UserDetails) obj.getPrincipal();

     // more code
}
Kotlin
@GetMapping("feature")
fun feature(obj: UserDetails) {
    val details = obj.getPrincipal() as UserDetails

    // more code
}
Select one or more options from the list
___

Create a free account to access the full topic