Results 1 to 6 of 6

Thread: Problems with factory-method

  1. #1

    Exclamation Problems with factory-method

    Hello All,

    I am having a problem with factory-method -

    I have a bean definition (say X.class) which has a factory-method definition pointing to createInstance which is a static method my class X which takes 4 parameters which I am initializing through the <constructor-arg/> definitions.

    At runtime, my webapplication doesn't start saying it cannot find any matching factory methods - factory-method createInstance.

    Any reason for this behaviour?

    I am stuck with this problem, any help would be of great help.

    Thanks & Regards
    Surya

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Please post the configuration..
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    <code>
    <bean id="x" class="com.test.X" factory-method="createInstance">
    <constructor-arg value="${type}" type="java.lang.String" index="0" />
    <constructor-arg value="${stream}" type="java.io.InputStream" index="1" />
    <constructor-arg value="${name}" type="java.lang.String" index="2" />
    <constructor-arg value="${substring}" type="java.lang.String" index="3" />
    </bean>
    </code> is the configuration that I have

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Please use [ code][/code ] tags (square brackets) that way it gets formatted correctly.

    Can you also post the code (factory method/class) and the stacktrace....
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jun 2012
    Posts
    2

    Default

    Quote Originally Posted by techiemails@yahoo.com View Post
    <code>
    <bean id="x" class="com.test.X" factory-method="createInstance">
    <constructor-arg value="${type}" type="java.lang.String" index="0" />
    <constructor-arg value="${stream}" type="java.io.InputStream" index="1" />
    <constructor-arg value="${name}" type="java.lang.String" index="2" />
    <constructor-arg value="${substring}" type="java.lang.String" index="3" />
    </bean>
    </code> is the configuration that I have
    are you missing "factory-bean" parameter ?, I am new to Spring so may be wrong but a pointer for you.

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Quote Originally Posted by user585858
    are you missing "factory-bean" parameter ?,
    No he isn't... That is only used if you want to call a factory method on an instance instead of a static-factory method.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •