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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:52:22+00:00 2026-05-12T05:52:22+00:00

I have used Spring before but I am no expert and only used it

  • 0

I have used Spring before but I am no expert and only used it for standard web-development previously.

Currently, I am working on a project where Spring is being used very differently. It’s a stand-alone Swing app which has many displays and the user can switch between a display via a toolbar. When the display changes, all the components need to be destroyed (garbage-collected).

Currently, this is done by having separate ApplicationContexts associated with each display. So when the display is changed, the idea is that the AppCtx associated with the display is destroyed then a new app context is created (from a different XML file) to load the components in the new display.

Is this an appropriate way of using Spring? I don’t know much about the internals of the Spring Container and the way the container manages the beans so I can’t figure out whether it’s a good thing or not.

  • 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-12T05:52:22+00:00Added an answer on May 12, 2026 at 5:52 am

    Sounds to me like you should be using a custom scope.

    As of Spring 2.0, the bean scoping mechanism in Spring is extensible. This means that you are not limited to just the bean scopes that Spring provides out of the box; you can define your own scopes, or even redefine the existing scopes (although that last one would probably be considered bad practice – please note that you cannot override the built-in singleton and prototype scopes).

    The problem with your approach is mainly performance, as you will be parsing/configuring/defining/instantiating spring beans on every screen change. I suggest you use instead a custom scope of screen ( let’s say ), which returns separate objects per scope.

    See the Scope javadoc for implementation details.

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

Sidebar

Related Questions

My current web development tool is Spring 3, I've used Hibernate before, I'm actually
Attempting to get Spring internationalization working. I have used classpath:messages basename, created .properties files
I have a web service written in Spring MVC. It can be used by
I used some Java Web App Frameworks before like Struts, Struts2, Spring MVC and
I have generated a spring project using Roo, and used the security setup addon
I have used Spring OXM and JiBX in my application. below is my Spring
I have used spring MVC with JSP/JSTL for my previous application. I was going
I have used spring framework 3 for my application. Everything is ok while developed
I always have used Spring Framework classes as-is. However I am thinking of customizing
I am relatively new to the Spring Framework and Spring security. I have used

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.