Announcement Announcement Module
Collapse
No announcement yet.
Problems with factory-method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Please post the configuration..

    Comment


    • #3
      <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

      Comment


      • #4
        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....

        Comment


        • #5
          Originally posted by [email protected] 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.

          Comment


          • #6
            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.

            Comment

            Working...
            X