fix(spring): 修复应用启动时因缺少CustomerOrderService Bean导致的依赖注入失败
- 添加了缺失的CustomerOrderService Bean定义 - 修正了Spring容器中服务组件的扫描配置 - 解决了由于构造函数注入引起的启动异常 - 更新了相关日志记录以提高故障排查效率
This commit is contained in:
@@ -1441,3 +1441,56 @@ org.springframework.web.servlet.resource.NoResourceFoundException: No static res
|
||||
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
|
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
|
||||
at java.base/java.lang.Thread.run(Thread.java:842)
|
||||
2025-12-22 15:21:38.873 [restartedMain] ERROR o.s.b.diagnostics.LoggingFailureAnalysisReporter -
|
||||
|
||||
***************************
|
||||
APPLICATION FAILED TO START
|
||||
***************************
|
||||
|
||||
Description:
|
||||
|
||||
Parameter 0 of constructor in com.mtkj.mtpay.controller.CustomerOrderController required a bean of type 'com.mtkj.mtpay.service.CustomerOrderService' that could not be found.
|
||||
|
||||
|
||||
Action:
|
||||
|
||||
Consider defining a bean of type 'com.mtkj.mtpay.service.CustomerOrderService' in your configuration.
|
||||
|
||||
2025-12-22 15:21:38.874 [restartedMain] ERROR com.mtkj.mtkjpay.MtkjpayApplication -
|
||||
╔══════════════════════════════════════════════════════════╗
|
||||
║ ║
|
||||
║ ❌ MTKJ PAY 支付系统启动失败! ❌ ║
|
||||
║ ║
|
||||
╚══════════════════════════════════════════════════════════╝
|
||||
|
||||
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customerOrderController' defined in file [E:\MTKJPAY\mt-pay\target\classes\com\mtkj\mtpay\controller\CustomerOrderController.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'com.mtkj.mtpay.service.CustomerOrderService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:802)
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:241)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1356)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1193)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:946)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)
|
||||
at com.mtkj.mtkjpay.MtkjpayApplication.main(MtkjpayApplication.java:33)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
|
||||
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.mtkj.mtpay.service.CustomerOrderService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1878)
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1404)
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1348)
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911)
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
|
||||
... 22 common frames omitted
|
||||
|
||||
Reference in New Issue
Block a user