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

The Archive Base Latest Questions

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

I have a library doing runtime setup and configuration of log4j (no log4j.properties or

  • 0

I have a library doing runtime setup and configuration of log4j (no log4j.properties or log4j.xml). I have defined a bean with class called MyLoggerFactory and I want this to be the first bean to be initialised using spring. I have seen that an issue has already been filed with spring to have support for order of initialisation but I was wondering whether there was a way to mark a bean as the first bean to be initialised by spring container?

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

    Your options are:

    1. Use @DependsOn annotation(available after spring 3.0.x) or depends-on xml-attribute and make all classes that use the configured loggers depend on the logger factory
    2. Make the factory an actual factory for loggers, and inject the loggers into the beans instead of calling the factory directly – this is essentially the same as option 1, except the dependency is implied. This is the option I’d recommend.
    3. Move the initialisation code to a part of your code where call order is specified – the main() method, or a ServletContextListener registered before the one that initializes Spring.

    There is no way to explicitly define initialisation order in Spring and likely never will be – there’s no way to define useful semantics for it considering you can load many application context configuration files which might have conflicting orderings. I’ve yet to see a case where the desired ordering couldn’t be achieved by refactoring your code to better conform to the dependency injection pattern.

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

Sidebar

Related Questions

I have this library called BASS which is an audio library which I'm going
I have a library written in C++/CLI and I want to open it up.
I have a simple class library that I use in Excel. Here is a
i have created a com class library with vb.net. i have registered the dll
I have a library that interacts with our phone system, ie, Hey phone, call
I have gdata library install on my ArchLinux, and a simple application which imports
I have a library written in C that I would like to use in
We have a Library Project that we use for all our central reused code
I have a library that does I/O. There are a couple of external knobs
I have a library that I created with some business logic that includes writing

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.