Jul 27, 2011 10:56:15 AM org.springframework.web.servlet.FrameworkServlet
initServletBean
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from ServletContext resource
[/WEB-INF/dispatcher-servlet.xml];
nested exception is java.lang.IllegalStateException:
Annotation-specified bean name 'fooController' for
bean class [com.fooapp.ctrl.FooController]
conflicts with existing, non-compatible bean definition of same name
and class [com.fooapp.ctrl.admin.FooController]
In both packages I defined the Controller using the @Controller
annotation:
@Controller
public class FooController {
...
Do I have to use a different name for the Controller in the admin
package?
The default bean-name for a @Component
or derivative (@Controller
, @Service
, etc.) is the unqualified class name with a lower first character. In order to have those two controllers together, just set a different bean name (for at least one of them):
@Controller("secondFooController")
Check this section of the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With