• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown

Spring Role Hierarchy: NullPointerException

Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to implement Role hierarchy and then use it in method security.
For the simplicity its just two roles here: ADMIN and GOAL. ADMIN includes GOAL.
I created RoleHierarchy Bean in a separate Configuration file, because some people here stated that Spring Security filters need to be configured quite early.

I'm getting following errors:
When I'm accessing the controller I'm getting a NullPointer error (which stated below)
Another controllers which stated in antMatchers stops working too with the same error.

1.Where is the error?
2.Do I need to declare my custom hierarchy in GlobalMethodSecurityConfiguration or WebSecurityConfigurerAdapter or both?

Source code:

RoleHierarchy Bean



Tried to also use @PreAuthorize("hasRole('ROLE_GOAL')" or @PreAuthorize("hasRole('GOAL')".

Error when accesssing the controller:
    Bookmark Topic Watch Topic
  • New Topic