org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'resourcesSpecificationController' method public com.anhry.ansafety.entity.base.page.Single com.anhry.ansafety.controller.resources.ResourcesSpecificationController.save(com.anhry.ansafety.entity.resources.TbResourcesSpecification) to {[/regulations/save]}: There is already 'resourcesRegulationsController' bean method public com.anhry.ansafety.entity.base.page.Single com.anhry.ansafety.controller.resources.ResourcesRegulationsController.save(com.anhry.ansafety.entity.resources.TbResourcesRegulations) mapped.
时间: 2024-04-28 13:20:23 浏览: 133
这个错误是因为在项目中存在两个或多个方法都映射到了同一个URL路径,从而导致了重复映射的错误。具体来说,'ResourcesSpecificationController' 类中的 'save' 方法和 'ResourcesRegulationsController' 类中的 'save' 方法都映射到了同一个URL路径 '/regulations/save',导致冲突。需要检查项目中的Controller类和RequestMapping注解,确保每个URL路径只被映射到一个方法上。可以考虑修改其中一个方法的映射路径来解决这个问题。
相关问题
Error creating bean with name 'sentinelBeanPostProcessor' defined in class path resource [com/alibaba/cloud/sentinel/custom/SentinelAutoConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.jcache.config.ProxyJCacheConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
这个错误是由于在创建bean时出现了问题导致的。具体来说,这个错误是由于`SentinelAutoConfiguration`类中的`sentinelBeanPostProcessor` bean的创建失败引起的。创建该bean时,发生了一个`BeanPostProcessor`实例化之前的错误。
进一步查看错误堆栈,发现了更多的错误链。其中一个是`DynamicDataSourceAutoConfiguration` bean的创建失败,另一个是`ProxyCachingConfiguration` bean的创建失败,再有一个是`ProxyJCacheConfiguration` bean的创建失败,最后一个是`ProxyTransactionManagementConfiguration` bean的初始化失败。
最后一个错误是由于在切入点表达式中存在未绑定的形式参数引起的。这可能是由于切入点表达式中使用了一个参数,但没有为其提供具体的绑定值。
要解决这个问题,你可以检查并确保以上提到的每个bean的配置正确,并且没有任何缺失或错误的配置。另外,还需要检查切入点表达式中是否存在任何未绑定的参数,并进行相应的修正。
Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' defined in class path resource [org/springframework/data/web/config/ProjectingArgumentResolverRegistrar.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metaDataSourceAdvisor': Cannot resolve reference to bean 'methodSecurityMetadataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error Type referred to is not an annotation type: com$ruoyi$common$annotation$DataSource
这个错误似乎涉及到 Spring 框架的多个组件,包括数据访问、缓存、安全和事务等方面。根据错误信息的提示,可能的原因包括:
1. 配置文件中的某些配置项缺失或格式不正确,导致 Spring 无法正确初始化相关组件。
2. 代码中使用了不正确的注解类型或导入了不正确的类,导致 Spring 无法正确解析相关注解或依赖。
3. 某些依赖库版本不兼容或存在冲突,导致 Spring 无法正确加载相关组件。
你可以检查上述原因,尝试解决错误。如果你无法解决问题,建议提供更多的错误信息和配置文件内容,以便更好地帮助你解决问题。
阅读全文