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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:59:05+00:00 2026-05-26T11:59:05+00:00

After investigation of code I found: <bean id=TestBean class=com.test.checkDate factory-method=getPreviousDate> <constructor-arg value …………. ………………………….

  • 0

After investigation of code I found:

 <bean id="TestBean" class="com.test.checkDate"
 factory-method="getPreviousDate">
 <constructor-arg value .............

 ...............................

How it can be possible?
Thanks.

  • 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-26T11:59:06+00:00Added an answer on May 26, 2026 at 11:59 am

    From docs

    the constructor arguments specified in the bean definition will be
    used to pass in as arguments to the constructor of the ExampleBean.
    Now consider a variant of this where instead of using a constructor,
    Spring is told to call a static factory method to return an instance
    of the object:

    <bean id="exampleBean" class="examples.ExampleBean"
          factory-method="createInstance">
      <constructor-arg ref="anotherExampleBean"/>
      <constructor-arg ref="yetAnotherBean"/>
      <constructor-arg value="1"/> 
    </bean>
    
    <bean id="anotherExampleBean" class="examples.AnotherBean"/>
    <bean id="yetAnotherBean" class="examples.YetAnotherBean"/>
    

    public class ExampleBean {
    
        // a private constructor
        private ExampleBean(...) {
          ...
        }
    
        // a static factory method; the arguments to this method can be
        // considered the dependencies of the bean that is returned,
        // regardless of how those arguments are actually used.
        public static ExampleBean createInstance (
                AnotherBean anotherBean, YetAnotherBean yetAnotherBean, int i) {
    
            ExampleBean eb = new ExampleBean (...);
            // some other operations...
                return eb;
        }
    }
    

    Note that arguments to the static factory method are supplied via
    constructor-arg elements, exactly the same as if a constructor had
    actually been used. Also, it is important to realize that the type of
    the class being returned by the factory method does not have to be of
    the same type as the class which contains the static factory method,
    although in this example it is. An instance (non-static) factory
    method would be used in an essentially identical fashion (aside from
    the use of the factory-bean attribute instead of the class attribute),
    so details will not be discussed here.

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

Sidebar

Related Questions

After a bit of investigation, I found that C++0x stores the elements in a
I'm writing an identi.ca client, and seems that @reply isn't working. After investigation I
I'm new to the world of PHP frameworks and, after some initial investigation, came
After lots of attempts and search I have never found a satisfactory way to
I posted a similar question earlier and received some good suggestions. After further investigation,
---AFTER FURTHER INVESTIGATION--- tblABC in the below example must be a linked table (to
After writing code that can be boiled down to the following: var size=-1; var
After further investigation, I've realized it's to do with the flash plugin not working,
Update OK, after some investigation, and thanks in big part to the helpful answers
I need to localize a SQL Server 2008 database. After investigating recommendations, I have

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.