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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:11:08+00:00 2026-06-12T10:11:08+00:00

In my application in some places we are using @ManagedBean annoation for Person bean

  • 0

In my application in some places we are using @ManagedBean annoation for Person bean and for the same Person bean we defining in the faces-confing.xml like below at the same time.

@ManagedBean("name=person")
 @SessionScoped
 Public class Person{


}

faces-config.xml

<managed-bean>
     <managed-bean-name>person</managed-bean-name>
     <managed-bean-class>com.test.sample.Person</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

my question is does this approach create two instances for the Person bean or it does matter if I do this? Does this have any effect on performance of my application If I do this for every Bean in my application?

  • 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-06-12T10:11:09+00:00Added an answer on June 12, 2026 at 10:11 am

    There’s a priority defined for this case. @ManagedBean annotation avoids having to configure an entry in faces-config.xml but, if you have both, the <managed-bean> entry overrides the annotation.

    In your case, there’ll be only one instance configured like your faces-config.xml entry. In your case, both approaches are configured the same way but, should you change your faces-config.xml entry to something like

    <managed-bean>
         <managed-bean-name>personBean</managed-bean-name>
         <managed-bean-class>com.test.sample.Person</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    

    Your bean will be registered under personBean rather than person (which is the name defined by the annotation).

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

Sidebar

Related Questions

Some application we're using depends on TComponent descendants to easily save/load the state of
I have an application with some bunch of code like this: errCode = callMainSystem();
I am using the MVVM pattern for a WPF application. In several places I
OK, I am building an application that will be using ASIHttpRequest in several places
I'm designing a Java application using SWT. I have some tables which will display
I am using hibernate and spring for my web application. In this at some
I have a GWT MVP application using Activities and Places. This is inspired by
I currently using Google Places API for retrieving information for in a mobile application(iOS
I'm writing an ASP.Net MVC application using Jquery to post some data to my
I have seen in some places that while using Expandable List View we register

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.