java怎么拦截某个对象
261
2022-10-25
A bean with that name has already been defined in DataSourceConfiguration$Hikari.class overriding无效
The bean ‘dataSource’, defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration H i k a r i . c l a s s ] , c o u l d n o t b e r e g i s t e r e d . A b e a n w i t h t h a t n a m e h a s a l r e a d y b e e n d e f i n e d i n c l a s s p a t h r e s o u r c e [ o r g / s p r i n g f r a m e w o r k / b o o t / a u t o c o n f i g u r e / j d b c / D a t a S o u r c e C o n f i g u r a t i o n Hikari.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration Hikari.class],couldnotberegistered.Abeanwiththatnamehasalreadybeendefinedinclasspathresource[org/springframework/boot/autoconfigure/jdbc/DataSourceConfigurationHikari.class] and overriding is disabled.
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54474,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/Users/ws/Library/Caches/IntelliJIdea2019.1/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/tools.jar:/Users/ws/dev/SourceTree/ocpmgp-parent/project-svc/target/classes:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/boot/spring-boot-starter-data-jpa/2.1.0.RELEASE/spring-boot-starter-data-jpa-2.1.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/boot/spring-boot-starter-aop/2.1.0.RELEASE/spring-boot-starter-aop-2.1.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-aop/5.1.2.RELEASE/spring-aop-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/boot/spring-boot-starter-jdbc/2.1.0.RELEASE/spring-boot-starter-jdbc-2.1.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/zaxxer/HikariCP/3.2.0/HikariCP-3.2.0.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-jdbc/5.1.2.RELEASE/spring-jdbc-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/javax/transaction/javax.transaction-api/1.3/javax.transaction-api-1.3.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/hibernate/hibernate-core/5.3.7.Final/hibernate-core-5.3.7.Final.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/javassist/javassist/3.23.1-GA/javassist-3.23.1-GA.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/net/bytebuddy/byte-buddy/1.9.3/byte-buddy-1.9.3.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/jboss/jandex/2.0.5.Final/jandex-2.0.5.Final.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/dom4j/dom4j/2.1.1/dom4j-2.1.1.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/hibernate/common/hibernate-commons-annotations/5.0.4.Final/hibernate-commons-annotations-5.0.4.Final.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/data/spring-data-jpa/2.1.2.RELEASE/spring-data-jpa-2.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/data/spring-data-commons/2.1.2.RELEASE/spring-data-commons-2.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-orm/5.1.2.RELEASE/spring-orm-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-context/5.1.2.RELEASE/spring-context-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-expression/5.1.2.RELEASE/spring-expression-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-tx/5.1.2.RELEASE/spring-tx-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-beans/5.1.2.RELEASE/spring-beans-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-aspects/5.1.2.RELEASE/spring-aspects-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/springfox/springfox-swagger2/2.9.2/springfox-swagger2-2.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/swagger/swagger-annotations/1.5.20/swagger-annotations-1.5.20.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/swagger/swagger-models/1.5.20/swagger-models-1.5.20.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/springfox/springfox-spi/2.9.2/springfox-spi-2.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/springfox/springfox-core/2.9.2/springfox-core-2.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/springfox/springfox-schema/2.9.2/springfox-schema-2.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/springfox/springfox-swagger-common/2.9.2/springfox-swagger-common-2.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/google/guava/guava/20.0/guava-20.0.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/plugin/spring-plugin-metadata/1.2.0.RELEASE/spring-plugin-metadata-1.2.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/mapstruct/mapstruct/1.2.0.Final/mapstruct-1.2.0.Final.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/springfox/springfox-swagger-ui/2.9.2/springfox-swagger-ui-2.9.2.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/intercom/intercom-java/2.8.0/intercom-java-2.8.0.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/fasterxml/jackson/core/jackson-core/2.9.7/jackson-core-2.9.7.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar:/Users/ws/dev/SourceTree/ocpmgp-parent/common-lib/target/classes:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/boot/spring-boot-starter-web/2.1.0.RELEASE/spring-boot-starter-web-2.1.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/boot/spring-boot-starter-json/2.1.0.RELEASE/spring-boot-starter-json-2.1.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.7/jackson-datatype-jdk8-2.9.7.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.7/jackson-datatype-jsr310-2.9.7.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.7/jackson-module-parameter-names-2.9.7.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.0.RELEASE/spring-boot-starter-tomcat-2.1.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.12/tomcat-embed-el-9.0.12.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.12/tomcat-embed-websocket-9.0.12.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/hibernate/validator/hibernate-validator/6.0.13.Final/hibernate-validator-6.0.13.Final.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-web/5.1.2.RELEASE/spring-web-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/spring-webmvc/5.1.2.RELEASE/spring-webmvc-5.1.2.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/cloud/spring-cloud-starter-openfeign/2.0.0.RELEASE/spring-cloud-starter-openfeign-2.0.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/cloud/spring-cloud-starter/2.0.0.RELEASE/spring-cloud-starter-2.0.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/cloud/spring-cloud-context/2.0.0.RELEASE/spring-cloud-context-2.0.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/security/spring-security-rsa/1.0.5.RELEASE/spring-security-rsa-1.0.5.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/cloud/spring-cloud-openfeign-core/2.0.0.RELEASE/spring-cloud-openfeign-core-2.0.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/cloud/spring-cloud-netflix-ribbon/2.0.0.RELEASE/spring-cloud-netflix-ribbon-2.0.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/cloud/spring-cloud-commons/2.0.0.RELEASE/spring-cloud-commons-2.0.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/security/spring-security-crypto/5.1.1.RELEASE/spring-security-crypto-5.1.1.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/github/openfeign/feign-core/9.5.1/feign-core-9.5.1.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/github/openfeign/feign-slf4j/9.5.1/feign-slf4j-9.5.1.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/github/openfeign/feign-hystrix/9.5.1/feign-hystrix-9.5.1.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/netflix/archaius/archaius-core/0.6.6/archaius-core-0.6.6.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/google/code/findbugs/annotations/2.0.0/annotations-2.0.0.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/netflix/hystrix/hystrix-core/1.4.26/hystrix-core-1.4.26.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/github/openfeign/feign-java8/9.5.1/feign-java8-9.5.1.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/org/springframework/cloud/spring-cloud-starter-netflix-ribbon/2.0.0.RELEASE/spring-cloud-starter-netflix-ribbon-2.0.0.RELEASE.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/netflix/ribbon/ribbon/2.2.5/ribbon-2.2.5.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/com/netflix/ribbon/ribbon-transport/2.2.5/ribbon-transport-2.2.5.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar:/Users/ws/dev/maven/apache-maven-3.5.3/repository/io/netty/netty-codec-IDEA.app/Contents/lib/idea_rt.jar" cci.ocpmgp.project.ProjectApplicationConnected to the target VM, address: '127.0.0.1:54474', transport: 'socket' . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.1.0.RELEASE)21-08-2019 16:47:29.480 [restartedMain] INFO c.ocpmgp.project.ProjectApplication.logStartupProfileInfo - No active profile set, falling back to default profiles: default21-08-2019 16:47:31.245 [restartedMain] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext.refresh - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'dataSource' defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Cannot register bean definition [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] for bean 'dataSource': There is already [Root bean: class [null]; scope=refresh; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] bound.21-08-2019 16:47:31.260 [restartedMain] ERROR o.s.b.d.LoggingFailureAnalysisReporter.report - ***************************APPLICATION FAILED TO START***************************Description:The bean 'dataSource', defined in BeanDefinition defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class] and overriding is disabled.Action:Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=trueDisconnected from the target VM, address: '127.0.0.1:54474', transport: 'socket'Process finished with exit code 0
解决办法:
我的暂时解决办法:
#YML中配置overriding为true,就可以了。 main: allow-bean-definition-overriding: true
日志显示Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
#proertiesspring.main.allow-bean-definition-overriding=true
详细的了解情况:
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~