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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:18:08+00:00 2026-05-28T20:18:08+00:00

Using Spring 3.0.x, I’m running into an issue where a Bean init-method is running,

  • 0

Using Spring 3.0.x, I’m running into an issue where a Bean init-method is running, and as part of it fetches some information, and then in another thread (original init() thread waits on the other threads to complete) tries to get one or more Beans based on that information retrieve. Problem is, these other Beans are singleton as well and haven’t been initialized yet. There’s a synchronized() block down in DefaultSingletonBeanRegistry in the getSingleton() methods.

The problem arises that I’m trying to get/initialize a Bean while I’m currently initializing a Bean, so I get stuck with the main thread in the init() method, and another thread trying to get another singleton Bean, and is blocked because the 1st thread has the lock.

So, the way I see it, I have 2 options:

1) Get Spring to run a method AFTER the singleton has been fully created that performs the actual data fetch and processing
2) Come up with message passing to which will give the data back to the main thread to then process them all within it since it already has the monitor lock

Thoughts? Ideas? How would I get #1 to work?

  • 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-28T20:18:09+00:00Added an answer on May 28, 2026 at 8:18 pm

    Have you tried implementing the InitializingBean interface

    class MyBean implements InitializingBean{
    
        @Override
        public void afterPropertiesSet(){
           // fetch information, etc
        }
    }
    

    According to the docs:

    Interface to be implemented by beans that need to react once all their properties have been > set by a BeanFactory: for example, to perform custom initialization…

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

Sidebar

Related Questions

I'm using Spring.net with NHiberante (HibernateTemplate) to implement my DAO's. I also have some
I've been using spring for some time, but I always wondered how does it
I'm using Spring 2.5.6. I have a bean whose properties are being assign from
I am using Spring 3.0.2. I have two relatively simple bean definitions. One has
For using spring request scope bean is this definition correct? <bean id=shoppingCart class=ShoppingCart scope=request>
I Am using Spring's @ExceptionHandler annotation to catch exceptions in my controllers. Some requests
Using Spring/SpringMVC 3.0.5 I've defined a method in my controller like this: @RequestMapping(params =
I'm using spring(3.0.4.RELEASE) and hibernate (3.4.0.GA) and deploying into a glassfish (web_3.1) container. I
Using Spring 2.5 tag library, I have an Integer value in a command form
When using spring security, specifically with @notation; what is the proper way to access

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.