This question most likely has been asked before. But I couldn't find it because searching a real hashtag in Google seems to be difficult. I suppose it's not called a hashtag and it's one of the relatively rare moments where my English fails me (2nd language).
So despite this being a duplicate, I'd argue to keep it on the site so that it is easier searchable via Google (and the SO site itself!).
I have the following code.
@GetMapping("/users")
@Timed
@PreAuthorize("hasAuthority('ADMINISTRATOR') or #oauth2.hasScope('some-user-list')")
public ResponseEntity<List<UserDTO>> getAllUsers(@ApiParam Pageable pageable) {
final Page<UserDTO> page = userService.getAllUsers(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/users");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
What does the #
mean (in particular for #oauth2
, I know what authentication is and what oauth does, I just don't understand the #
as a concept in Spring)? How is it called? This doesn't seem to pertain to the Java language itself, so how does Spring Boot call this concept?
It's part of the Spring Expression Language (Spring EL).
It allows you to write dynamic expressions, conditions and other things that would be impossible (or at least very clumsy) otherwise.
Similar expression languages exist in other frameworks (e.g. JSF EL), and they usually look very similar in syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With