Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7581395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:11:31+00:00 2026-05-30T18:11:31+00:00

I searched for the answer, but didn’t find it. If I add <intercept-url pattern=/test*

  • 0

I searched for the answer, but didn’t find it. If I add <intercept-url pattern="/test*" access="ROLE_USER" /> inside the <form-login> of my spring-security.xml, everything works predictably. But if I want @RolesAllowed("ROLE_ADMIN") to act for the method:

@RolesAllowed("ROLE_ADMIN")
@RequestMapping(value="/test", method = RequestMethod.GET)
public String test() {
    return "test";
}        

And if spring-security.xml looks like this (jsr250-annotations are enabled):

<http auto-config="true">
    <form-login login-page="/login.html" 
                default-target-url="/welcome.html"
                authentication-failure-url="/loginfailed.html" />
    <logout logout-success-url="/logout.html" />
</http>          

<authentication-manager>
  <authentication-provider>
        <user-service>
                <user name="john" password="doe" authorities="ROLE_ADMIN" />
                <user name="jane" password="doe" authorities="ROLE_USER" />
        </user-service>
  </authentication-provider>
</authentication-manager>

<global-method-security   secured-annotations="enabled" jsr250-annotations="enabled" />

Well, in this case both John and Jane can access the test page. I think I missed something basic, the help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:11:33+00:00Added an answer on May 30, 2026 at 6:11 pm

    If you change @RolesAllowed to @PreAuthorize("hasAuthority('ROLE_ADMIN')") and define global-method-security with pre-post-annotations="enabled" attribute, does it work?

    Also, I suppose that it’s not working because you define global-method-security and other configuration in servlet config instead of application context.

    See similar post: https://stackoverflow.com/a/2525048/352708

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

sorry for this question, but I searched it and I didn't find an answer
Hello I searched for an answer to this question but didn't find any here.
I searched the net and books, for an answer but didn't find it. (maybe
I searched across the web but I didn't find any satisfying answer. I have
HI! I have searched a lot, but I didn't find the answer to this
I searched, but didn't find good answer to this: It should be pretty straightforward,
Well I searched a lot, but I didn't find a precise answer how to
I read on here and searched a lot but didn't find the answer, so
I have searched a bit on google, but didn't really found an answer to
I've searched for the answer to this question but I can't seem to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.