spring not enforcing method security annotations

后端 未结 7 1127
心在旅途
心在旅途 2021-01-01 20:05

I\'m some what lost as to why spring isn\'t enforcing the @Secured(\"ROLE_USER\") on my service interface. My controllers are established using annotations.

An exam

7条回答
  •  被撕碎了的回忆
    2021-01-01 20:19

    After doing more research on this problem I came to the following conclusion/solution. I'm not sure if it's 100% correct..but it works.

    I put all of my configuration in the dispatcher-servlet.xml file. So instead of having a disptacher-servlet.xml and application-context.xml. The dispatcher-servlet.xml is loaded by the application (contextConfigLocation). Within the dispatcher-servlet.xml I import my security-context.xml and datasource-context.xml. Afer that, everything works.

提交回复
热议问题