代码拉取完成,页面将自动刷新
这个项目在单独启动时会报错
The bean 'fastDFSUploader', defined in class path resource [com/qiwenshare/ufop/autoconfiguration/UFOPAutoConfiguration.class], could not be registered. A bean with that name has already been defined in file [/Users/richard/IdeaProjects/ufop-spring-boot-starter/target/classes/com/qiwenshare/ufop/operation/upload/product/FastDFSUploader.class] and overriding is disabled.
重现步骤:
1.把ufop-spring-boot-starter项目拉到本地
2.com.qiwenshare.ufop包里创建App.java类
内容如下:
package com.qiwenshare.ufop;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
结果如下:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.2)
2022-02-01 18:02:20.983 INFO 60136 --- [ main] com.qiwenshare.ufop.App : Starting App using Java 1.8.0_261 on richards-MacBook-Pro.local with PID 60136 (/Users/richard/IdeaProjects/ufop-spring-boot-starter/target/classes started by richard in /Users/richard/IdeaProjects/ufop-spring-boot-starter)
2022-02-01 18:02:20.990 INFO 60136 --- [ main] com.qiwenshare.ufop.App : No active profile set, falling back to default profiles: default
2022-02-01 18:02:21.677 WARN 60136 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'fastDFSUploader' defined in class path resource [com/qiwenshare/ufop/autoconfiguration/UFOPAutoConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.qiwenshare.ufop.autoconfiguration.UFOPAutoConfiguration; factoryMethodName=fastDFSUploader; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/qiwenshare/ufop/autoconfiguration/UFOPAutoConfiguration.class]] for bean 'fastDFSUploader': There is already [Generic bean: class [com.qiwenshare.ufop.operation.upload.product.FastDFSUploader]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/Users/richard/IdeaProjects/ufop-spring-boot-starter/target/classes/com/qiwenshare/ufop/operation/upload/product/FastDFSUploader.class]] bound.
2022-02-01 18:02:21.685 INFO 60136 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-02-01 18:02:21.700 ERROR 60136 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'fastDFSUploader', defined in class path resource [com/qiwenshare/ufop/autoconfiguration/UFOPAutoConfiguration.class], could not be registered. A bean with that name has already been defined in file [/Users/richard/IdeaProjects/ufop-spring-boot-starter/target/classes/com/qiwenshare/ufop/operation/upload/product/FastDFSUploader.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Disconnected from the target VM, address: '127.0.0.1:62916', transport: 'socket'
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
这个问题,会造成依赖它的项目,打包后,都不能正常使用.
这主要是由于重复配置造成的
该工程的使用方式是错误的,应该作为一个依赖引入到工程中,使用demo: UFOP使用参考代码
也可以参考该工程的readme文档
登录 后才可以发表评论