Guest User

Untitled

a guest
Oct 24th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. @Entity
  2. @Table(name = "users")
  3. @Getter
  4. @Setter
  5. public class User {
  6.  
  7. @Id
  8. @Column(name = "user_id", nullable = false, updatable = false)
  9. private Long id;
  10.  
  11. ...
  12.  
  13. }
  14.  
  15. @Repository
  16. public interface UserRepository extends JpaRepository<User, Long> {
  17.  
  18. @Override
  19. @PreAuthorize("#user.id == principal.username")
  20. void delete(User user);
  21.  
  22. ...
  23.  
  24. }
  25.  
  26. java.lang.IllegalArgumentException: Failed to evaluate expression '#user.id == principal.username'
  27. ...
  28. Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'id' cannot be found on null
Add Comment
Please, Sign In to add comment