2

I have two beans containing the same property name and reference bean, could this be causing my error?:

javax.servlet.UnavailableException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Cannot map handler x to URL path /path There is already handler of type [class myclass] mapped.

Code:

<bean name="bean1"
    class="myclass1">
    <property name="property">
        <ref bean="ref" />
    </property>
</bean>



<bean name="bean2"
    class="myclass2">
    <property name="property">
        <ref bean="ref" />
    </property>
</bean>

I can't seem to trace my error anywhere else. Please comment if you need more information.

Edit: The console prints the error is Caused by: java.lang.IllegalStateException: Cannot map handler

I also have another exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed

Jordan.J.D
  • 7,999
  • 11
  • 48
  • 78

1 Answers1

1

I ended up removing all of:

<bean name="bean2"
    class="myclass2">
    <property name="property">
        <ref bean="ref" />
    </property>
</bean>

And my controller started mapping correctly.

Jordan.J.D
  • 7,999
  • 11
  • 48
  • 78