WebApplicationContext : org.springframework.web.context.ContextLoaderListener作用

本文详细介绍了如何在自定义的Servlet类别中整合Spring容器功能,通过使用ContextLoaderListener和WebApplicationContextUtils来读取配置文件并获取Bean实例。
摘至:http://blog.youkuaiyun.com/taijianyu/article/details/3176263
如果您想要在自己所定义的Servlet类别中使用Spring的容器功能,则也可以使用 org.springframework.web.context.ContextLoaderListener,例如在web.xml中使用< listener>标签加以定义:

...
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
...


ContextLoaderListener预设会读取applicationContext.xml,您可以指定自己的定义档,只要在<context-param>中指定"contextConfigLocation"参数,例如:

...
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/beans-config.xml,
→ /WEB-INF/demo-service.xml</param-value>
</context-param>
...


接着您可以在自定义的Servlet中使用 org.springframework.web.context.support.WebApplicationContextUtils,从 ServletContext中取得org.springframework.web.context.WebApplicationContext,例如:

WebApplicationContext ctx =
WebApplicationContextUtils.
getRequiredWebApplicationContext(
this.getServletContext());


WebApplicationContext实作了ApplicationContext介面,是Spring专为Servlet的Web应用程式设计的 ApplicationContext实作类别,在取得WebApplicationContext之后,您可以利用它来取得Bean定义档中定义的 Bean实例,例如:
Date date = (Date) ctx.getBean("dateBean");
2025-10-23 10:59:25.929 INFO [org.apache.catalina.core.StandardServer] A valid shutdown command was received via the shutdown port. Stopping the Server instance. 2025-10-23 10:59:25.929 INFO [org.apache.coyote.http11.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-16909"] 2025-10-23 10:59:27.189 INFO [org.apache.coyote.http11.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-8080"] 2025-10-23 10:59:27.251 INFO [org.apache.coyote.ajp.AjpNioProtocol] Pausing ProtocolHandler ["ajp-nio-16061"] 2025-10-23 10:59:27.315 INFO [org.apache.catalina.core.StandardService] Stopping service Catalina 2025-10-23 10:59:27.320 INFO [org.apache.coyote.http11.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-16909"] 2025-10-23 10:59:27.421 INFO [org.apache.coyote.http11.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-8080"] 2025-10-23 10:59:27.422 INFO [org.apache.coyote.ajp.AjpNioProtocol] Stopping ProtocolHandler ["ajp-nio-16061"] 2025-10-23 10:59:27.425 INFO [org.apache.coyote.http11.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-16909"] 2025-10-23 10:59:27.426 INFO [org.apache.coyote.http11.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-8080"] 2025-10-23 10:59:27.426 INFO [org.apache.coyote.ajp.AjpNioProtocol] Destroying ProtocolHandler ["ajp-nio-16061"] 2025-10-23 10:59:30.284 INFO [org.apache.catalina.startup.VersionLoggerListener] Server version: Apache Tomcat/8.0.39 2025-10-23 10:59:30.285 INFO [org.apache.catalina.startup.VersionLoggerListener] Server built: Nov 9 2016 08:48:39 UTC 2025-10-23 10:59:30.285 INFO [org.apache.catalina.startup.VersionLoggerListener] Server number: 8.0.39.0 2025-10-23 10:59:30.285 INFO [org.apache.catalina.startup.VersionLoggerListener] OS Name: Windows 10 2025-10-23 10:59:30.285 INFO [org.apache.catalina.startup.VersionLoggerListener] OS Version: 10.0 2025-10-23 10:59:30.285 INFO [org.apache.catalina.startup.VersionLoggerListener] Architecture: amd64 2025-10-23 10:59:30.286 INFO [org.apache.catalina.startup.VersionLoggerListener] Java Home: C:\Program Files\Java\jdk8u302-b08\jre 2025-10-23 10:59:30.286 INFO [org.apache.catalina.startup.VersionLoggerListener] JVM Version: 1.8.0_302-b08 2025-10-23 10:59:30.286 INFO [org.apache.catalina.startup.VersionLoggerListener] JVM Vendor: Temurin 2025-10-23 10:59:30.286 INFO [org.apache.catalina.startup.VersionLoggerListener] CATALINA_BASE: C:\Users\ex_fanyuting\AppData\Local\JetBrains\IntelliJIdea2025.1\tomcat\a9aa55cb-e673-493b-8816-99e838c44513 2025-10-23 10:59:30.286 INFO [org.apache.catalina.startup.VersionLoggerListener] CATALINA_HOME: D:\soft\tpaicwebservice-tomcat8.0\tpaicwebservice-tomcat8.0 2025-10-23 10:59:30.286 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:57334,suspend=y,server=n 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -javaagent:C:\Users\ex_fanyuting\AppData\Local\JetBrains\IntelliJIdea2025.1\captureAgent\debugger-agent.jar=file:///C:/Users/ex_fanyuting/AppData/Local/Temp/capture10069411290205542943.props 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dkotlinx.coroutines.debug.enable.creation.stack.trace=false 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Ddebugger.agent.enable.coroutines=true 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dkotlinx.coroutines.debug.enable.flows.stack.trace=true 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dkotlinx.coroutines.debug.enable.mutable.state.flows.stack.trace=true 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dcom.sun.management.jmxremote= 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dcom.sun.management.jmxremote.port=1099 2025-10-23 10:59:30.287 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dcom.sun.management.jmxremote.ssl=false 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dcom.sun.management.jmxremote.password.file=C:\Users\ex_fanyuting\AppData\Local\JetBrains\IntelliJIdea2025.1\tomcat\a9aa55cb-e673-493b-8816-99e838c44513\jmxremote.password 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dcom.sun.management.jmxremote.access.file=C:\Users\ex_fanyuting\AppData\Local\JetBrains\IntelliJIdea2025.1\tomcat\a9aa55cb-e673-493b-8816-99e838c44513\jmxremote.access 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Djava.rmi.server.hostname=127.0.0.1 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dnop 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 2025-10-23 10:59:30.288 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Djava.endorsed.dirs=D:\soft\tpaicwebservice-tomcat8.0\tpaicwebservice-tomcat8.0\endorsed 2025-10-23 10:59:30.289 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dcatalina.base=C:\Users\ex_fanyuting\AppData\Local\JetBrains\IntelliJIdea2025.1\tomcat\a9aa55cb-e673-493b-8816-99e838c44513 2025-10-23 10:59:30.289 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Dcatalina.home=D:\soft\tpaicwebservice-tomcat8.0\tpaicwebservice-tomcat8.0 2025-10-23 10:59:30.289 INFO [org.apache.catalina.startup.VersionLoggerListener] Command line argument: -Djava.io.tmpdir=D:\soft\tpaicwebservice-tomcat8.0\tpaicwebservice-tomcat8.0\temp 2025-10-23 10:59:30.289 INFO [org.apache.catalina.core.AprLifecycleListener] The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk8u302-b08\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Oracle\product\11.2.0\client_1;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Java\jdk8u302-b08\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;D:\soft\maven\apache-maven-3.9.9\bin;C:\Program Files\dotnet\;D:\AAAlcq\rocketmq-all-5.1.4-bin-release\bin;C:\insolu\client001;C:\Users\ex_fanyuting\AppData\Local\Microsoft\WindowsApps;;D:\soft\IntelliJ IDEA 2025\bin;;D:\soft\Microsoft VS Code\bin;. 2025-10-23 10:59:30.365 INFO [org.apache.coyote.http11.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-16909"] 2025-10-23 10:59:30.386 INFO [org.apache.tomcat.util.net.NioSelectorPool] Using a shared selector for servlet write/read 2025-10-23 10:59:30.388 INFO [org.apache.coyote.http11.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-8080"] 2025-10-23 10:59:30.395 INFO [org.apache.tomcat.util.net.NioSelectorPool] Using a shared selector for servlet write/read 2025-10-23 10:59:30.396 INFO [org.apache.coyote.ajp.AjpNioProtocol] Initializing ProtocolHandler ["ajp-nio-16061"] 2025-10-23 10:59:30.403 INFO [org.apache.tomcat.util.net.NioSelectorPool] Using a shared selector for servlet write/read 2025-10-23 10:59:30.404 INFO [org.apache.catalina.startup.Catalina] Initialization processed in 340 ms 2025-10-23 10:59:30.440 INFO [org.apache.catalina.core.StandardService] Starting service Catalina 2025-10-23 10:59:30.440 INFO [org.apache.catalina.core.StandardEngine] Starting Servlet Engine: Apache Tomcat/8.0.39 2025-10-23 10:59:30.453 INFO [org.apache.coyote.http11.Http11NioProtocol] Starting ProtocolHandler ["http-nio-16909"] 2025-10-23 10:59:30.463 INFO [org.apache.coyote.http11.Http11NioProtocol] Starting ProtocolHandler ["http-nio-8080"] 2025-10-23 10:59:30.469 INFO [org.apache.coyote.ajp.AjpNioProtocol] Starting ProtocolHandler ["ajp-nio-16061"] 2025-10-23 10:59:30.476 INFO [org.apache.catalina.startup.Catalina] Server startup in 72 ms 2025-10-23 10:59:47.387 INFO [org.apache.jasper.servlet.TldScanner] At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 2025-10-23 10:59:47.422 INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/tpaicwebservice]] No Spring WebApplicationInitializer types detected on classpath 2025-10-23 10:59:47.426 INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/tpaicwebservice]] Initializing Spring root WebApplicationContext 2025-10-23 11:00:07.294 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/tpaicwebservice]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'policyIssueController' defined in ServletContext resource [/WEB-INF/tpaicwebservice-service-servlet.xml]: Cannot resolve reference to bean 'dispatchService' while setting bean property 'dispatch'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dispatchService' defined in ServletContext resource [/WEB-INF/tpaicwebservice-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.tpaic.ws.biz' defined in class path resource [com/tpaic/ws/biz/beanRefContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'nonEndorseCallbackService' defined in class path resource [com/tpaic/yizhangtong/config/yzt-service-context.xml]: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}" at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1707) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:399) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:278) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at java.security.AccessController.doPrivileged(Native Method) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dispatchService' defined in ServletContext resource [/WEB-INF/tpaicwebservice-servlet.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.tpaic.ws.biz' defined in class path resource [com/tpaic/ws/biz/beanRefContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'nonEndorseCallbackService' defined in class path resource [com/tpaic/yizhangtong/config/yzt-service-context.xml]: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}" at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) ... 62 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.tpaic.ws.biz' defined in class path resource [com/tpaic/ws/biz/beanRefContext.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'nonEndorseCallbackService' defined in class path resource [com/tpaic/yizhangtong/config/yzt-service-context.xml]: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}" at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:315) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:296) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85) at com.tpaic.tpfa.app.contexton.ApplicationContexton$SpringContextUtil.getApplicationContext(ApplicationContexton.java:35) at com.tpaic.tpfa.app.contexton.ApplicationContexton.getFactory(ApplicationContexton.java:25) at com.tpaic.tpfa.app.biz.dispatch.impl.ServiceControllerLocalImpl.afterPropertiesSet(ServiceControllerLocalImpl.java:69) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ... 69 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'nonEndorseCallbackService' defined in class path resource [com/tpaic/yizhangtong/config/yzt-service-context.xml]: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}" at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:311) ... 88 more Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'nonEndorseCallbackService' defined in class path resource [com/tpaic/yizhangtong/config/yzt-service-context.xml]: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}" at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:230) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:211) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:325) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:183) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:748) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:95) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ... 90 more Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'yzt.nonEndorseCallbackUrl' in value "${yzt.nonEndorseCallbackUrl}" at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:230) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:296) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:217) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:147) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:85) at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:227) ... 103 more 2025-10-23 11:00:07.320 INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/tpaicwebservice]] Closing Spring root WebApplicationContext
最新发布
10-24
29-Jul-2025 16:30:14.267 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Spring WebApplicationInitializers detected on classpath: [org.glassfish.jersey.server.spring.SpringWebApplicationInitializer@d2e46ea7] 29-Jul-2025 16:30:14.306 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext 29-Jul-2025 16:30:15.929 涓ラ噸 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart 寮傚父灏嗕笂涓嬫枃鍒濆鍖栦簨浠跺彂閫佸埌绫荤殑渚﹀惉鍣ㄥ疄渚�.[org.springframework.web.context.ContextLoaderListener] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dipController' defined in file [D:\inpatient-api-wx\target\inpatient-api\WEB-INF\classes\com\hangyu\his\dip\controller\DipController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dipServiceImpl' defined in file [D:\inpatient-api-wx\target\inpatient-api\WEB-INF\classes\com\hangyu\his\dip\service\impl\DipServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dipMapper' defined in file [D:\inpatient-api-wx\target\inpatient-api\WEB-INF\classes\com\hangyu\his\dip\mapper\DipMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Invocation of init method failed; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1201) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4768) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1783) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:503) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:460) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:408) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:503) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at java.security.AccessController.doPrivileged(AccessController.java:785) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:503) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(AccessController.java:785) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) at java.security.AccessController.doPrivileged(AccessController.java:719) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:822) Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dipServiceImpl' defined in file [D:\inpatient-api-wx\target\inpatient-api\WEB-INF\classes\com\hangyu\his\dip\service\impl\DipServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dipMapper' defined in file [D:\inpatient-api-wx\target\inpatient-api\WEB-INF\classes\com\hangyu\his\dip\mapper\DipMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Invocation of init method failed; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1201) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ... 62 more Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dipMapper' defined in file [D:\inpatient-api-wx\target\inpatient-api\WEB-INF\classes\com\hangyu\his\dip\mapper\DipMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Invocation of init method failed; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1365) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1257) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ... 76 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Invocation of init method failed; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1537) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1284) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1350) ... 88 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in URL [file:/D:/inpatient-api-wx/target/inpatient-api/WEB-INF/classes/spring/spring-datasource.xml]: Invocation of init method failed; nested exception is java.sql.SQLException: com.mysql.jdbc.Driver at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1634) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ... 101 more Caused by: java.sql.SQLException: com.mysql.jdbc.Driver at com.alibaba.druid.util.JdbcUtils.createDriver(JdbcUtils.java:570) at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:697) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:503) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1763) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1700) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1630) ... 108 more Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:337) at com.alibaba.druid.util.JdbcUtils.createDriver(JdbcUtils.java:568) ... 116 more 29-Jul-2025 16:30:15.958 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext 是什么问题
07-30
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值