SpringClound项目相关

nacos本机模式非虚拟机启动也可正常连接

nacos中的配置中心相当于在application.yml中的相关配置,转移位置,内容同application.yml完全一样均可。

黑马项目导入后,依赖缺失:

  • 首先尝试maven重新加载,控制台提示传递依赖异常

    [WARNING] The POM for com.baomidou:mybatis-plus-boot-starter:jar:3.4.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] The POM for com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] The POM for com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] The POM for com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] The POM for com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:jar:2.2.5.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] The POM for com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:jar:2.2.5.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

尝试在缺失依赖处进行手动导入提示下方错误

2024-01-31 10:46:21.345 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt:
提示自动配置失败,refresh方法调用失败

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apUserLoginController': Unsatisfied dependency expressed through field 'apUserService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apUserServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apUserMapper' defined in file [D:\project\heima-leadnews\heima-leadnews-service\heima-leadnews-user\target\classes\com\heima\user\mapper\ApUserMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

2024-01-31 10:46:21.360 [main] INFO o.a.catalina.core.StandardService - Stopping service [Tomcat]

20 file:/D:/maven/respository/org/apache/hbase/hbase-protocol/2.1.5/hbase-protocol-2.1.5.jar, file:/D:/maven/respository/org/apache/hbase/thirdparty/hbase-shaded-miscellaneous/2.1.0/hbase-shaded-miscellaneous-2.1.0.jar, file:/D:/maven/respository/com/google/protobuf/protobuf-java/3.13.0/protobuf-java-3.13.0.jar, file:/D:/maven/respository/org/apache/hbase/thirdparty/hbase-shaded-netty/2.1.0/hbase-shaded-netty-2.1.0.jar, file:/D:/maven/respository/org/apache/zookeeper/zookeeper/3.4.10/zookeeper-3.4.10.jar, 2/knife4j-spring-boot-starter-2.0.2.jar, file:/D:/maven/respository/com/github/xiaoymin/knife4j-spring-boot-autoconfigure/2.0.2/knife4j-spring-boot-autoconfigure-2.0.2.jar, file:/D:/maven/respository/com/github/xiaoymin/knife4j-spring/2.0.2/knife4j-spring-2.0.2.jar, file:/D:/maven/respository/com/github/xiaoymin/knife4j-annotations/2.0.2/knife4j-annotations-2.0.2.jar, file:/D:/maven/respository/com/github/xiaoymin/knife4j-core/2.0.2/knife4j-core-2.0.2.jar, file:/D:/maven/respository/io/springfox/springfox-bean-validators/2.9.2/springfox-bean-validators-2.9.2.jar, file:/D:/maven/respository/com/github/xiaoymin/knife4j-spring-ui/2.0.2/knife4j-spring-ui- file:/D:/maven/respository/org/apache/tomcat/embed/tomcat-embed-core/9.0.43/tomcat-embed-core-9.0.43.jar, file:/D:/maven/respository/org/glassfish/jakarta.el/3.0.3/jakarta.el-3.0.3.jar, file:/D:/maven/respository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.43/tomcat-embed-websocket-9.0.43.jar, -slf4j-1.7.30.jar, file:/D:/maven/respository/org/projectlombok/lombok/1.18.8/lombok-1.18.8.jar, file:/D:/Software/IntelliJ%20IDEA%202021.2.1/lib/idea_rt.jar]

2024-01-31 10:46:21.392 [main] DEBUG o.s.b.a.l.ConditionEvaluationReportLoggingListener -

============================

CONDITIONS EVALUATION REPORT :条件评估报告,下方的自动配置可能失效

============================

Positive matches:


AopAutoConfiguration matched:

  • @ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)

AopAutoConfiguration.ClassProxyingConfiguration matched:

  • @ConditionalOnMissingClass did not find unwanted class 'org.aspectj.weaver.Advice' (OnClassCondition)

  • @ConditionalOnProperty (spring.aop.proxy-target-class=true) matched (OnPropertyCondition)

AuditEventsEndpointAutoConfiguration matched:

  • @ConditionalOnAvailableEndpoint no property management.endpoint.auditevents.enabled found so using endpoint default; @ConditionalOnAvailableEndpoint marked as exposed by a 'management.endpoints.jmx.exposure' property (OnAvailableEndpointCondition)

CommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration matched:

  • @ConditionalOnClass found required class 'org.springframework.boot.actuate.health.HealthIndicator' (OnClassCondition)

  • @ConditionalOnProperty (spring.cloud.discovery.enabled) matched; @ConditionalOnProperty (spring.cloud.discovery.blocking.enabled) matched (OnPropertyCondition)

  • @ConditionalOnBean (types: org.springframework.cloud.client.discovery.DiscoveryClient; SearchStrategy: all) found beans 'nacosDiscoveryClient', 'simpleDiscoveryClient', 'compositeDiscoveryClient' (OnBeanCondition)

CommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration#discoveryClientHealthIndicator matched:

  • @ConditionalOnProperty (spring.cloud.discovery.client.health-indicator.enabled) matched (OnPropertyCondition)

CommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration#discoveryCompositeHealthContributor matched:

  • @ConditionalOnProperty (spring.cloud.discovery.client.composite-indicator.enabled) matched (OnPropertyCondition)

  • @ConditionalOnBean (types: org.springframework.cloud.client.discovery.health.DiscoveryHealthIndicator; SearchStrategy: all) found bean 'discoveryClientHealthIndicator' (OnBeanCondition)

CompatibilityVerifierAutoConfiguration matched:

  • @ConditionalOnProperty (spring.cloud.compatibility-verifier.enabled) matched (OnPropertyCondition)

CompositeMeterRegistryAutoConfiguration matched:

  • @ConditionalOnClass found required class 'io.micrometer.core.instrument.composite.CompositeMeterRegistry' (OnClassCondition)

ConditionsReportEndpointAutoConfiguration matched:

  • @ConditionalOnAvailableEndpoint no property management.endpoint.conditions.enabled found so using endpoint default; @ConditionalOnAvailableEndpoint marked as exposed by a 'management.endpoints.jmx.exposure' property (OnAvailableEndpointCondition)

ConditionsReportEndpointAutoConfiguration#conditionsReportEndpoint matched:

  • @ConditionalOnMissingBean (types: org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpoint; SearchStrategy: current) did not find any beans (OnBeanCondition)

ConfigurationPropertiesReportEndpointAutoConfiguration matched:

  • @ConditionalOnAvailableEndpoint no property management.endpoint.configprops.enabled found so using endpoint default; @ConditionalOnAvailableEndpoint marked as exposed by a 'management.endpoints.jmx.exposure' property (OnAvailableEndpointCondition)

ConfigurationPropertiesReportEndpointAutoConfiguration#configurationPropertiesReportEndpoint matched:

  • @ConditionalOnMissingBean (types: org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint; SearchStrategy: all) did not find any beans (OnBeanCondition)

DiskSpaceHealthContributorAutoConfiguration matched:

  • @ConditionalOnEnabledHealthIndicator management.health.defaults.enabled is considered true (OnEnabledHealthIndicatorCondition)

DiskSpaceHealthContributorAutoConfiguration#diskSpaceHealthIndicator matched:

  • @ConditionalOnMissingBean (names: diskSpaceHealthIndicator; SearchStrategy: all) did not find any beans (OnBeanCondition)

DispatcherServletAutoConfiguration matched:

  • @ConditionalOnClass found required class 'org.springframework.web.servlet.DispatcherServlet' (OnClassCondition)

  • found 'session' scope (OnWebApplicationCondition)

DispatcherServletAutoConfiguration.DispatcherServletConfiguration matched:

  • @ConditionalOnClass found required class 'javax.servlet.ServletRegistration' (OnClassCondition)

  • @ConditionalOnClass found required class 'org.springframework.http.converter.json.Jackson2ObjectMapperBuilder' (OnClassCondition)

JacksonAutoConfiguration.JacksonObjectMapperBuilderConfiguration matched:

  • @ConditionalOnClass found required class 'org.springframework.http.converter.json.Jackson2ObjectMapperBuilder' (OnClassCondition)

JacksonAutoConfiguration.JacksonObjectMapperBuilderConfiguration#jacksonObjectMapperBuilder matched:

  • @ConditionalOnMissingBean (types: org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; SearchStrategy: all) did not find any beans (OnBeanCondition)

JacksonAutoConfiguration.JacksonObjectMapperConfiguration matched:

  • @ConditionalOnClass found required class 'org.springframework.http.converter.json.Jackson2ObjectMapperBuilder' (OnClassCondition)

io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics; SearchStrategy: all) did not find any beans (OnBeanCondition)

JvmMetricsAutoConfiguration#jvmGcMetrics matched:

CacheMeterBinderProvidersConfiguration.HazelcastCacheMeterBinderProviderConfiguration:

Did not match:

  • @ConditionalOnClass did not find required classes 'com.hazelcast.spring.cache.HazelcastCache', 'com.hazelcast.core.Hazelcast' (OnClassCondition)

CacheMeterBinderProvidersConfiguration.JCacheCacheMeterBinderProviderConfiguration:

Did not match:

  • @ConditionalOnClass did not find required class 'javax.cache.CacheManager' (OnClassCondition)

CacheMetricsAutoConfiguration:

  • @ConditionalOnWebApplication did not find reactive web application classes (OnWebApplicationCondition)

WebSocketServletAutoConfiguration.JettyWebSocketConfiguration:

Did not match:

  • @ConditionalOnClass did not find required class 'org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer' (OnClassCondition)

WebSocketServletAutoConfiguration.UndertowWebSocketConfiguration:

Did not match:

  • @ConditionalOnClass did not find required class 'io.undertow.websockets.jsr.Bootstrap' (OnClassCondition)

XADataSourceAutoConfiguration:

Did not match:

  • @ConditionalOnClass did not find required class 'javax.transaction.TransactionManager' (OnClassCondition)

Exclusions: 除外


None

Unconditional classes: 无条件的类


com.github.tobato.fastdfs.FdfsClientConfig

org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration

com.heima.common.exception.ExceptionCatch

org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration

2024-01-31 10:46:21.408 [main] ERROR o.s.boot.SpringApplication - Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apUserLoginController': Unsatisfied dependency expressed through field 'apUserService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apUserServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apUserMapper' defined in file [D:\project\heima-leadnews\heima-leadnews-service\heima-leadnews-user\target\classes\com\heima\user\mapper\ApUserMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660)
at

Bean后置增强,注入失败

sqlSessionFactory:每个基于 MyBatis 的应用都是以一个 SqlSessionFactory 的实例为核心的,SqlSessionFactory 的实例可以通过 SqlSessionFactoryBuilder 获得。而 SqlSessionFactoryBuilder 则可以从 XML 配置文件中读取,结合上文初步推测,未正确读取nacos配置的数据源信息导致

org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)

at

Process finished with exit code 1

相关推荐
两点王爷5 分钟前
Java读取csv文件内容,保存到sqlite数据库中
java·数据库·sqlite·csv
lvbu_2024war0115 分钟前
MATLAB语言的网络编程
开发语言·后端·golang
问道飞鱼16 分钟前
【Springboot知识】Springboot进阶-实现CAS完整流程
java·spring boot·后端·cas
抓哇小菜鸡24 分钟前
WebSocket
java·websocket
single59428 分钟前
【c++笔试强训】(第四十五篇)
java·开发语言·数据结构·c++·算法
游客52029 分钟前
自动化办公-合并多个excel
开发语言·python·自动化·excel
Q_192849990635 分钟前
基于Spring Boot的电影网站系统
java·spring boot·后端
Cshaosun39 分钟前
js版本之ES6特性简述【Proxy、Reflect、Iterator、Generator】(五)
开发语言·javascript·es6
凡人的AI工具箱1 小时前
每天40分玩转Django:Django部署概述
开发语言·数据库·后端·python·django
老鑫安全培训1 小时前
从安全角度看 SEH 和 VEH
java·网络·安全·网络安全·系统安全·安全威胁分析