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

  • Home
  • SEARCH
  • 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 7609497
In Process

The Archive Base Latest Questions

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

I have a session scoped bean in my @Controller: it is called SessionPreferences and

  • 0

I have a session scoped bean in my @Controller: it is called SessionPreferences and I hope its name will explain what it does 🙂

Almost any of my controllers make use of it, so I easily inject it in each controller via @Autowired.

I wanna go deeper so…. how can I avoid this duplication? Can I have a “father” controller in my application, in order to store all shared references to services, other beans and so on?

  • 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-31T01:11:10+00:00Added an answer on May 31, 2026 at 1:11 am

    Maybe an abstract class that the controllers implement would be helpful?

    If I’m understanding you, though, you want a class that you basically inject all of your services and daos into directly then the rest of those classes would inherit off of it?

    This might cause issues with the way Spring sets up it’s proxies when classes reference the singletons you inject. Not 100% sure though, might want to avoid doing this.

    Also, if you break one of your services, all of your controllers that inherit from that base class would be broken, don’t really recommend this. You’re coupling your controllers with too many facets of your application.

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

Sidebar

Related Questions

I have a session scoped managed bean with name 'usermanager'. i want to store
I have a Session scoped bean @SessionScoped public class UserData implements Serializable { private
I have a form bean defined in session scope and a controller bean defined
I have a session-scoped bean in Spring that is set within the web context.
Assume I have a session scoped bean with object references in it, where the
I have a session scoped managed bean, with a property current . If I
I have already one session scoped CDI bean, which keeps currently logged in user
I have a JSF 2.0 application(App#1) that has a managed Session Scoped bean that
I have a table (session) in a database which has almost 72,000 rows. I
I have a Controller bean (SearchController) that has two managed bean as managed properties

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.