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 6734513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:53:52+00:00 2026-05-26T10:53:52+00:00

I have a certain entity that can possibly be edited by different actors. A

  • 0

I have a certain entity that can possibly be edited by different actors. A good example for the scenario would be an user of a system, who can edit their personal data (phone no, e-mail, password), but cannot modify e.g. their privileges or username, which could of course be done by a super-user.

So, would it be too brutal and ugly if I just annotated the setter methods with @PreAuthorize? The only disadvantage I could think of is the performance loss, but since there are no bulk operations involving the entity I am thinking of and those setters will never be called often it doesn’t seem like a concern now.

  • 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-26T10:53:52+00:00Added an answer on May 26, 2026 at 10:53 am

    I wouldn’t advise for that. First, if I see things properly, @PreAuthorize requires a class to be a bean. And generally, entities are not spring beans (unless you use the @Configurable magic). So it just won’t work.

    Second, the better place for @PreAuthorize is on the business methods that perform the modifications.

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

Sidebar

Related Questions

Can I have certain settings that are universal for all my users?
WPF controls have certain properties (UserControl.Resources, UserControl.CommandBindings) that can have items added to them
I would like to select all elements that have certain attribute or don't have
I have a library with an IJobMaker entity that creates a certain amount of
I have certain strings which contain special characters so they can not be shared
I have certain PHP class methods that access external variables. These variables are not
I have certain panels on my page that are hidden under certain circumstances. For
I have certain critical bash scripts that are invoked by code I don't control,
I have certain initializing functions that I use to set up audit logging on
I have an entity that plays an animation that runs in my world at

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.