ContextLoader-api

本文深入探讨了Spring容器初始化过程中的关键配置项,包括如何指定上下文类型、配置位置,以及如何加载共享父上下文。同时介绍了如何利用ContextLoader类进行容器初始化,并通过实例展示了配置参数的具体应用。

ContextLoader-api

分类: J2EE spring   106人阅读  评论(0)  收藏  举报
 


/**
 * Performs the actual initialization work for the root application context.
 * Called by {@link ContextLoaderListener} and {@link ContextLoaderServlet}.
 *翻译:

这个类将会被ContextLoaderListener或者ContextLoaderServlet调用来实际执行spring容器(root application context)

的初始化工作。
 * <p>Looks for a {@link #CONTEXT_CLASS_PARAM "contextClass"} parameter
 * at the <code>web.xml</code> context-param level to specify the context
 * class type, falling back to the default of
 * {@link org.springframework.web.context.support.XmlWebApplicationContext}
 * if not found. With the default ContextLoader implementation, any context class
 * specified needs to implement the ConfigurableWebApplicationContext interface.
 *

翻译:

在web.xml文件的context-param中寻找名为 "contextClass"的变量(CONTEXT_CLASS_PARAM )来指定context的类型,如果

在配置文件中找不到这个变量,那么将使用默认的类型,org.springframework.web.context.support.XmlWebApplicationContext。

如果使用默认的ContextLoader的实现类,任何一个context类都必须要实现ConfigurableWebApplicationContext接口。


 * <p>Processes a {@link #CONFIG_LOCATION_PARAM "contextConfigLocation"}
 * context-param and passes its value to the context instance, parsing it into
 * potentially multiple file paths which can be separated by any number of
 * commas and spaces, e.g. "WEB-INF/applicationContext1.xml,
 * WEB-INF/applicationContext2.xml". Ant-style path patterns are supported as well,
 * e.g. "WEB-INF/*Context.xml,WEB-INF/spring*.xml" or "WEB-INF/&#42;&#42;/*Context.xml".
 * If not explicitly specified, the context implementation is supposed to use a
 * default location (with XmlWebApplicationContext: "/WEB-INF/applicationContext.xml").
 *

翻译:

在处理web.xml里面的名为"contextConfigLocation"的context-param 变量CONFIG_LOCATION_PARAM 的时候,会将这个变量

的值传递到context实例中去。这个值可以是由逗号和空格分开的多个文件路径,例如可以是"WEB-INF/applicationContext1.xml,
 WEB-INF/applicationContext2.xml"。除此之外,这个值还可以用ant风格的方式书写,例如"WEB-INF/*Context.xml,WEB-INF/spring*.xml" 或者 "WEB-INF/&#42;&#42;/*Context.xml"。如果在web.xml中设置这个变量,那么spring会使用默认的路径XmlWebApplicationContext: "/WEB-INF/applicationContext.xml"


 * <p>Note: In case of multiple config locations, later bean definitions will
 * override ones defined in previously loaded files, at least when using one of
 * Spring's default ApplicationContext implementations. This can be leveraged
 * to deliberately override certain bean definitions via an extra XML file.
 *

翻译:

注意:

如果使用了多个配置文件路径而且使用了Spring的ApplicationContext默认实现类的话,对于同一个bean,后来加载的

文件的内容会复写较前加载的文件的内容。所以,我们可以利用这个特性,通过额外的xml 配置文件(当然要较后加载)

来复写某个bean的配置信息。


 * <p>Above and beyond loading the root application context, this class
 * can optionally load or obtain and hook up a shared parent context to
 * the root application context. See the
 * {@link #loadParentContext(ServletContext)} method for more information.
 *

翻译:

除了读取根容器信息(root application context)之外,这个类可以选择去读取,获得或者挂起根容器信息(root application context)

的共有的父容器信息。
 * @author Juergen Hoeller
 * @author Colin Sampaleanu
 * @author Sam Brannen

 * @author 译者:kaiwii
 * @since 17.02.2003
 * @see ContextLoaderListener
 * @see ContextLoaderServlet
 * @see ConfigurableWebApplicationContext
 * @see org.springframework.web.context.support.XmlWebApplicationContext
 */
public class ContextLoader {

 /**
  * Config param for the root WebApplicationContext implementation class to
  * use: "<code>contextClass</code>"
  */
 public static final String CONTEXT_CLASS_PARAM = "contextClass";

翻译:

root WebApplicationContext实现类的配置参数,名为"contextClass"

 /**
  * Name of servlet context parameter (i.e., "<code>contextConfigLocation</code>")
  * that can specify the config location for the root context, falling back
  * to the implementation's default otherwise.
  * @see org.springframework.web.context.support.XmlWebApplicationContext#DEFAULT_CONFIG_LOCATION
  */
 public static final String CONFIG_LOCATION_PARAM = "contextConfigLocation";

 

 /**
  * Optional servlet context parameter (i.e., "<code>locatorFactorySelector</code>")
  * used only when obtaining a parent context using the default implementation
  * of {@link #loadParentContext(ServletContext servletContext)}.
  * Specifies the 'selector' used in the
  * {@link ContextSingletonBeanFactoryLocator#getInstance(String selector)}
  * method call, which is used to obtain the BeanFactoryLocator instance from
  * which the parent context is obtained.
  * <p>The default is <code>classpath*:beanRefContext.xml</code>,
  * matching the default applied for the
  * {@link ContextSingletonBeanFactoryLocator#getInstance()} method.
  * Supplying the "parentContextKey" parameter is sufficient in this case.
  */
 public static final String LOCATOR_FACTORY_SELECTOR_PARAM = "locatorFactorySelector";

 /**
  * Optional servlet context parameter (i.e., "<code>parentContextKey</code>")
  * used only when obtaining a parent context using the default implementation
  * of {@link #loadParentContext(ServletContext servletContext)}.
  * Specifies the 'factoryKey' used in the
  * {@link BeanFactoryLocator#useBeanFactory(String factoryKey)} method call,
  * obtaining the parent application context from the BeanFactoryLocator instance.
  * <p>Supplying this "parentContextKey" parameter is sufficient when relying
  * on the default <code>classpath*:beanRefContext.xml</code> selector for
  * candidate factory references.
  */
 public static final String LOCATOR_FACTORY_KEY_PARAM = "parentContextKey";

 /**
  * Name of the class path resource (relative to the ContextLoader class)
  * that defines ContextLoader's default strategy names.
  */
 private static final String DEFAULT_STRATEGIES_PATH = "ContextLoader.properties";


 private static final Properties defaultStrategies;

 static {
  // Load default strategy implementations from properties file.
  // This is currently strictly internal and not meant to be customized
  // by application developers.
  try {
   ClassPathResource resource = new ClassPathResource(DEFAULT_STRATEGIES_PATH, ContextLoader.class);
   defaultStrategies = PropertiesLoaderUtils.loadProperties(resource);
  }
  catch (IOException ex) {
   throw new IllegalStateException("Could not load 'ContextLoader.properties': " + ex.getMessage());
  }
 }


 private static final Log logger = LogFactory.getLog(ContextLoader.class);

 /**
  * Map from (thread context) ClassLoader to WebApplicationContext.
  * Often just holding one reference - if the ContextLoader class is
  * deployed in the web app ClassLoader itself!
  */
 private static final Map currentContextPerThread = CollectionFactory.createConcurrentMapIfPossible(1);

 /**
  * The root WebApplicationContext instance that this loader manages.
  */
 private WebApplicationContext context;

 /**
  * Holds BeanFactoryReference when loading parent factory via
  * ContextSingletonBeanFactoryLocator.
  */
 private BeanFactoryReference parentContextRef;


 /**
  * Initialize Spring's web application context for the given servlet context,
  * according to the "{@link #CONTEXT_CLASS_PARAM contextClass}" and
  * "{@link #CONFIG_LOCATION_PARAM contextConfigLocation}" context-params.
  * @param servletContext current servlet context
  * @return the new WebApplicationContext
  * @throws IllegalStateException if there is already a root application context present
  * @throws BeansException if the context failed to initialize
  * @see #CONTEXT_CLASS_PARAM
  * @see #CONFIG_LOCATION_PARAM
  */
 public WebApplicationContext initWebApplicationContext(ServletContext servletContext)
   throws IllegalStateException, BeansException {

  if (servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null) {
   throw new IllegalStateException(
     "Cannot initialize context because there is already a root application context present - " +
     "check whether you have multiple ContextLoader* definitions in your web.xml!");
  }

  servletContext.log("Initializing Spring root WebApplicationContext");
  if (logger.isInfoEnabled()) {
   logger.info("Root WebApplicationContext: initialization started");
  }
  long startTime = System.currentTimeMillis();

  try {
   // Determine parent for root web application context, if any.
   ApplicationContext parent = loadParentContext(servletContext);

   // Store context in local instance variable, to guarantee that
   // it is available on ServletContext shutdown.
   this.context = createWebApplicationContext(servletContext, parent);
   servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.context);
   currentContextPerThread.put(Thread.currentThread().getContextClassLoader(), this.context);

   if (logger.isDebugEnabled()) {
    logger.debug("Published root WebApplicationContext as ServletContext attribute with name [" +
      WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + "]");
   }
   if (logger.isInfoEnabled()) {
    long elapsedTime = System.currentTimeMillis() - startTime;
    logger.info("Root WebApplicationContext: initialization completed in " + elapsedTime + " ms");
   }

   return this.context;
  }
  catch (RuntimeException ex) {
   logger.error("Context initialization failed", ex);
   servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
   throw ex;
  }
  catch (Error err) {
   logger.error("Context initialization failed", err);
   servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, err);
   throw err;
  }
 }

 /**
  * Instantiate the root WebApplicationContext for this loader, either the
  * default context class or a custom context class if specified.
  * <p>This implementation expects custom contexts to implement the
  * {@link ConfigurableWebApplicationContext} interface.
  * Can be overridden in subclasses.
  * <p>In addition, {@link #customizeContext} gets called prior to refreshing the
  * context, allowing subclasses to perform custom modifications to the context.
  * @param servletContext current servlet context
  * @param parent the parent ApplicationContext to use, or <code>null</code> if none
  * @return the root WebApplicationContext
  * @throws BeansException if the context couldn't be initialized
  * @see ConfigurableWebApplicationContext
  */
 protected WebApplicationContext createWebApplicationContext(
   ServletContext servletContext, ApplicationContext parent) throws BeansException {

  Class contextClass = determineContextClass(servletContext);
  if (!ConfigurableWebApplicationContext.class.isAssignableFrom(contextClass)) {
   throw new ApplicationContextException("Custom context class [" + contextClass.getName() +
     "] is not of type [" + ConfigurableWebApplicationContext.class.getName() + "]");
  }

  ConfigurableWebApplicationContext wac =
    (ConfigurableWebApplicationContext) BeanUtils.instantiateClass(contextClass);
  wac.setParent(parent);
  wac.setServletContext(servletContext);
  wac.setConfigLocation(servletContext.getInitParameter(CONFIG_LOCATION_PARAM));
  customizeContext(servletContext, wac);
  wac.refresh();

  return wac;
 }

 /**
  * Return the WebApplicationContext implementation class to use, either the
  * default XmlWebApplicationContext or a custom context class if specified.
  * @param servletContext current servlet context
  * @return the WebApplicationContext implementation class to use
  * @throws ApplicationContextException if the context class couldn't be loaded
  * @see #CONTEXT_CLASS_PARAM
  * @see org.springframework.web.context.support.XmlWebApplicationContext
  */
 protected Class determineContextClass(ServletContext servletContext) throws ApplicationContextException {
  String contextClassName = servletContext.getInitParameter(CONTEXT_CLASS_PARAM);
  if (contextClassName != null) {
   try {
    return ClassUtils.forName(contextClassName);
   }
   catch (ClassNotFoundException ex) {
    throw new ApplicationContextException(
      "Failed to load custom context class [" + contextClassName + "]", ex);
   }
  }
  else {
   contextClassName = defaultStrategies.getProperty(WebApplicationContext.class.getName());
   try {
    return ClassUtils.forName(contextClassName, ContextLoader.class.getClassLoader());
   }
   catch (ClassNotFoundException ex) {
    throw new ApplicationContextException(
      "Failed to load default context class [" + contextClassName + "]", ex);
   }
  }
 }

 /**
  * Customize the {@link ConfigurableWebApplicationContext} created by this
  * ContextLoader after config locations have been supplied to the context
  * but before the context is <em>refreshed</em>.
  * <p>The default implementation is empty but can be overridden in subclasses
  * to customize the application context.
  * @param servletContext the current servlet context
  * @param applicationContext the newly created application context
  * @see #createWebApplicationContext(ServletContext, ApplicationContext)
  */
 protected void customizeContext(
   ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
 }

 /**
  * Template method with default implementation (which may be overridden by a
  * subclass), to load or obtain an ApplicationContext instance which will be
  * used as the parent context of the root WebApplicationContext. If the
  * return value from the method is null, no parent context is set.
  * <p>The main reason to load a parent context here is to allow multiple root
  * web application contexts to all be children of a shared EAR context, or
  * alternately to also share the same parent context that is visible to
  * EJBs. For pure web applications, there is usually no need to worry about
  * having a parent context to the root web application context.
  * <p>The default implementation uses
  * {@link org.springframework.context.access.ContextSingletonBeanFactoryLocator},
  * configured via {@link #LOCATOR_FACTORY_SELECTOR_PARAM} and
  * {@link #LOCATOR_FACTORY_KEY_PARAM}, to load a parent context
  * which will be shared by all other users of ContextsingletonBeanFactoryLocator
  * which also use the same configuration parameters.
  * @param servletContext current servlet context
  * @return the parent application context, or <code>null</code> if none
  * @throws BeansException if the context couldn't be initialized
  * @see org.springframework.context.access.ContextSingletonBeanFactoryLocator
  */
 protected ApplicationContext loadParentContext(ServletContext servletContext)
   throws BeansException {

  ApplicationContext parentContext = null;
  String locatorFactorySelector = servletContext.getInitParameter(LOCATOR_FACTORY_SELECTOR_PARAM);
  String parentContextKey = servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM);

  if (parentContextKey != null) {
   // locatorFactorySelector may be null, indicating the default "classpath*:beanRefContext.xml"
   BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(locatorFactorySelector);
   if (logger.isDebugEnabled()) {
    logger.debug("Getting parent context definition: using parent context key of '" +
      parentContextKey + "' with BeanFactoryLocator");
   }
   this.parentContextRef = locator.useBeanFactory(parentContextKey);
   parentContext = (ApplicationContext) this.parentContextRef.getFactory();
  }

  return parentContext;
 }

 /**
  * Close Spring's web application context for the given servlet context. If
  * the default {@link #loadParentContext(ServletContext)} implementation,
  * which uses ContextSingletonBeanFactoryLocator, has loaded any shared
  * parent context, release one reference to that shared parent context.
  * <p>If overriding {@link #loadParentContext(ServletContext)}, you may have
  * to override this method as well.
  * @param servletContext the ServletContext that the WebApplicationContext runs in
  */
 public void closeWebApplicationContext(ServletContext servletContext) {
  servletContext.log("Closing Spring root WebApplicationContext");
  try {
   if (this.context instanceof ConfigurableWebApplicationContext) {
    ((ConfigurableWebApplicationContext) this.context).close();
   }
  }
  finally {
   currentContextPerThread.remove(Thread.currentThread().getContextClassLoader());
   servletContext.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
   if (this.parentContextRef != null) {
    this.parentContextRef.release();
   }
  }
 }


 /**
  * Obtain the Spring root web application context for the current thread
  * (i.e. for the current thread's context ClassLoader, which needs to be
  * the web application's ClassLoader).
  * @return the current root web application context, or <code>null</code>
  * if none found
  * @see org.springframework.web.context.support.SpringBeanAutowiringSupport
  */
 public static WebApplicationContext getCurrentWebApplicationContext() {
  return (WebApplicationContext) currentContextPerThread.get(Thread.currentThread().getContextClassLoader());
 }

}

 

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
"C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" -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:D:\IntelliJ IDEA 2019.2.3\lib\idea_rt.jar=59067:D:\IntelliJ IDEA 2019.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_181\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_181\jre\lib\rt.jar;C:\biili\新建文件夹\springboot-alidruid-master\target\classes;D:\zuoye\com\alibaba\druid-spring-boot-starter\1.1.23\druid-spring-boot-starter-1.1.23.jar;D:\zuoye\com\alibaba\druid\1.1.23\druid-1.1.23.jar;D:\zuoye\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;D:\zuoye\org\springframework\boot\spring-boot-autoconfigure\2.1.4.RELEASE\spring-boot-autoconfigure-2.1.4.RELEASE.jar;D:\zuoye\org\springframework\boot\spring-boot\2.1.4.RELEASE\spring-boot-2.1.4.RELEASE.jar;D:\zuoye\mysql\mysql-connector-java\8.0.15\mysql-connector-java-8.0.15.jar;D:\zuoye\org\projectlombok\lombok\1.16.20\lombok-1.16.20.jar;D:\zuoye\com\alibaba\fastjson\1.2.83\fastjson-1.2.83.jar;D:\zuoye\org\springframework\boot\spring-boot-starter-web\2.1.4.RELEASE\spring-boot-starter-web-2.1.4.RELEASE.jar;D:\zuoye\org\springframework\boot\spring-boot-starter\2.1.4.RELEASE\spring-boot-starter-2.1.4.RELEASE.jar;D:\zuoye\org\springframework\boot\spring-boot-starter-logging\2.1.4.RELEASE\spring-boot-starter-logging-2.1.4.RELEASE.jar;D:\zuoye\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\zuoye\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\zuoye\org\apache\logging\log4j\log4j-to-slf4j\2.11.2\log4j-to-slf4j-2.11.2.jar;D:\zuoye\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;D:\zuoye\org\slf4j\jul-to-slf4j\1.7.26\jul-to-slf4j-1.7.26.jar;D:\zuoye\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\zuoye\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;D:\zuoye\org\springframework\boot\spring-boot-starter-json\2.1.4.RELEASE\spring-boot-starter-json-2.1.4.RELEASE.jar;D:\zuoye\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.8\jackson-datatype-jdk8-2.9.8.jar;D:\zuoye\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.8\jackson-datatype-jsr310-2.9.8.jar;D:\zuoye\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.8\jackson-module-parameter-names-2.9.8.jar;D:\zuoye\org\springframework\boot\spring-boot-starter-tomcat\2.1.4.RELEASE\spring-boot-starter-tomcat-2.1.4.RELEASE.jar;D:\zuoye\org\apache\tomcat\embed\tomcat-embed-core\9.0.17\tomcat-embed-core-9.0.17.jar;D:\zuoye\org\apache\tomcat\embed\tomcat-embed-el\9.0.17\tomcat-embed-el-9.0.17.jar;D:\zuoye\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.17\tomcat-embed-websocket-9.0.17.jar;D:\zuoye\org\hibernate\validator\hibernate-validator\6.0.16.Final\hibernate-validator-6.0.16.Final.jar;D:\zuoye\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\zuoye\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;D:\zuoye\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;D:\zuoye\org\springframework\spring-web\5.1.6.RELEASE\spring-web-5.1.6.RELEASE.jar;D:\zuoye\org\springframework\spring-beans\5.1.6.RELEASE\spring-beans-5.1.6.RELEASE.jar;D:\zuoye\org\springframework\spring-webmvc\5.1.6.RELEASE\spring-webmvc-5.1.6.RELEASE.jar;D:\zuoye\org\springframework\spring-context\5.1.6.RELEASE\spring-context-5.1.6.RELEASE.jar;D:\zuoye\org\springframework\spring-expression\5.1.6.RELEASE\spring-expression-5.1.6.RELEASE.jar;D:\zuoye\org\springframework\boot\spring-boot-starter-aop\2.1.4.RELEASE\spring-boot-starter-aop-2.1.4.RELEASE.jar;D:\zuoye\org\springframework\spring-aop\5.1.6.RELEASE\spring-aop-5.1.6.RELEASE.jar;D:\zuoye\org\aspectj\aspectjweaver\1.9.2\aspectjweaver-1.9.2.jar;D:\zuoye\org\springframework\spring-core\5.1.6.RELEASE\spring-core-5.1.6.RELEASE.jar;D:\zuoye\org\springframework\spring-jcl\5.1.6.RELEASE\spring-jcl-5.1.6.RELEASE.jar;D:\zuoye\com\baomidou\mybatis-plus-boot-starter\3.4.0\mybatis-plus-boot-starter-3.4.0.jar;D:\zuoye\com\baomidou\mybatis-plus\3.4.0\mybatis-plus-3.4.0.jar;D:\zuoye\com\baomidou\mybatis-plus-extension\3.4.0\mybatis-plus-extension-3.4.0.jar;D:\zuoye\com\baomidou\mybatis-plus-core\3.4.0\mybatis-plus-core-3.4.0.jar;D:\zuoye\com\baomidou\mybatis-plus-annotation\3.4.0\mybatis-plus-annotation-3.4.0.jar;D:\zuoye\com\github\jsqlparser\jsqlparser\3.2\jsqlparser-3.2.jar;D:\zuoye\org\mybatis\mybatis\3.5.5\mybatis-3.5.5.jar;D:\zuoye\org\mybatis\mybatis-spring\2.0.5\mybatis-spring-2.0.5.jar;D:\zuoye\org\springframework\boot\spring-boot-starter-jdbc\2.1.4.RELEASE\spring-boot-starter-jdbc-2.1.4.RELEASE.jar;D:\zuoye\org\springframework\spring-jdbc\5.1.6.RELEASE\spring-jdbc-5.1.6.RELEASE.jar;D:\zuoye\org\springframework\spring-tx\5.1.6.RELEASE\spring-tx-5.1.6.RELEASE.jar;D:\zuoye\com\alibaba\transmittable-thread-local\2.12.6\transmittable-thread-local-2.12.6.jar;D:\zuoye\cn\hutool\hutool-all\5.8.29\hutool-all-5.8.29.jar;D:\zuoye\org\apache\commons\commons-lang3\3.8.1\commons-lang3-3.8.1.jar;D:\zuoye\io\jsonwebtoken\jjwt\0.9.1\jjwt-0.9.1.jar;D:\zuoye\com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar;D:\zuoye\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\zuoye\com\fasterxml\jackson\core\jackson-core\2.9.8\jackson-core-2.9.8.jar;D:\zuoye\com\github\xiaoymin\knife4j-openapi3-spring-boot-starter\4.5.0\knife4j-openapi3-spring-boot-starter-4.5.0.jar;D:\zuoye\com\github\xiaoymin\knife4j-core\4.5.0\knife4j-core-4.5.0.jar;D:\zuoye\com\github\xiaoymin\knife4j-openapi3-ui\4.5.0\knife4j-openapi3-ui-4.5.0.jar;D:\zuoye\org\springdoc\springdoc-openapi-ui\1.7.0\springdoc-openapi-ui-1.7.0.jar;D:\zuoye\org\springdoc\springdoc-openapi-webmvc-core\1.7.0\springdoc-openapi-webmvc-core-1.7.0.jar;D:\zuoye\org\springdoc\springdoc-openapi-common\1.7.0\springdoc-openapi-common-1.7.0.jar;D:\zuoye\io\swagger\core\v3\swagger-core\2.2.9\swagger-core-2.2.9.jar;D:\zuoye\jakarta\xml\bind\jakarta.xml.bind-api\2.3.2\jakarta.xml.bind-api-2.3.2.jar;D:\zuoye\jakarta\activation\jakarta.activation-api\1.2.1\jakarta.activation-api-1.2.1.jar;D:\zuoye\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml\2.9.8\jackson-dataformat-yaml-2.9.8.jar;D:\zuoye\io\swagger\core\v3\swagger-annotations\2.2.9\swagger-annotations-2.2.9.jar;D:\zuoye\io\swagger\core\v3\swagger-models\2.2.9\swagger-models-2.2.9.jar;D:\zuoye\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;D:\zuoye\org\webjars\swagger-ui\4.18.2\swagger-ui-4.18.2.jar;D:\zuoye\com\alibaba\cola\cola-component-exception\4.0.0\cola-component-exception-4.0.0.jar" com.zebra.charge.demo.StartApplication . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.1.4.RELEASE) 2025-05-29 20:31:37.044 INFO 26700 --- [ main] com.zebra.charge.demo.StartApplication : Starting StartApplication on wnjy2 with PID 26700 (started by 25120 in C:\biili\新建文件夹) 2025-05-29 20:31:37.046 INFO 26700 --- [ main] com.zebra.charge.demo.StartApplication : No active profile set, falling back to default profiles: default 2025-05-29 20:31:38.020 INFO 26700 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2025-05-29 20:31:38.033 INFO 26700 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2025-05-29 20:31:38.033 INFO 26700 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.17] 2025-05-29 20:31:38.110 INFO 26700 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2025-05-29 20:31:38.110 INFO 26700 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1025 ms Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter. 2025-05-29 20:31:38.273 INFO 26700 --- [ main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource 2025-05-29 20:31:38.455 INFO 26700 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited Registered plugin: 'com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor@664e5dee' Property 'mapperLocations' was not specified. _ _ |_ _ _|_. ___ _ | _ | | |\/|_)(_| | |_\ |_)||_|_\ / | 3.4.0 2025-05-29 20:31:39.377 INFO 26700 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2025-05-29 20:31:39.639 INFO 26700 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2025-05-29 20:31:39.641 INFO 26700 --- [ main] com.zebra.charge.demo.StartApplication : Started StartApplication in 2.904 seconds (JVM running for 3.71)
05-30
"C:\Program Files\Java\jdk-17\bin\java.exe" -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2025.1.2\lib\idea_rt.jar=56672" -Dfile.encoding=UTF-8 -classpath D:\study\计算机工程课设\medicine_management\target\classes;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.2.2.RELEASE\spring-boot-starter-web-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter\2.2.2.RELEASE\spring-boot-starter-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot\2.2.2.RELEASE\spring-boot-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.2.2.RELEASE\spring-boot-autoconfigure-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.2.2.RELEASE\spring-boot-starter-logging-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\LENOVO\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\LENOVO\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.12.1\log4j-to-slf4j-2.12.1.jar;C:\Users\LENOVO\.m2\repository\org\apache\logging\log4j\log4j-api\2.12.1\log4j-api-2.12.1.jar;C:\Users\LENOVO\.m2\repository\org\slf4j\jul-to-slf4j\1.7.29\jul-to-slf4j-1.7.29.jar;C:\Users\LENOVO\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\LENOVO\.m2\repository\org\yaml\snakeyaml\1.25\snakeyaml-1.25.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.2.2.RELEASE\spring-boot-starter-json-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.10.1\jackson-datatype-jdk8-2.10.1.jar;C:\Users\LENOVO\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.10.1\jackson-datatype-jsr310-2.10.1.jar;C:\Users\LENOVO\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.10.1\jackson-module-parameter-names-2.10.1.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.2.2.RELEASE\spring-boot-starter-tomcat-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.29\tomcat-embed-core-9.0.29.jar;C:\Users\LENOVO\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.29\tomcat-embed-el-9.0.29.jar;C:\Users\LENOVO\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.29\tomcat-embed-websocket-9.0.29.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-validation\2.2.2.RELEASE\spring-boot-starter-validation-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\jakarta\validation\jakarta.validation-api\2.0.1\jakarta.validation-api-2.0.1.jar;C:\Users\LENOVO\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.18.Final\hibernate-validator-6.0.18.Final.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-web\5.2.2.RELEASE\spring-web-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-beans\5.2.2.RELEASE\spring-beans-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-webmvc\5.2.2.RELEASE\spring-webmvc-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-context\5.2.2.RELEASE\spring-context-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-expression\5.2.2.RELEASE\spring-expression-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.2.2.RELEASE\spring-boot-starter-data-jpa-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.2.2.RELEASE\spring-boot-starter-aop-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\aspectj\aspectjweaver\1.9.5\aspectjweaver-1.9.5.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.2.2.RELEASE\spring-boot-starter-jdbc-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\com\zaxxer\HikariCP\3.4.1\HikariCP-3.4.1.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-jdbc\5.2.2.RELEASE\spring-jdbc-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\jakarta\activation\jakarta.activation-api\1.2.1\jakarta.activation-api-1.2.1.jar;C:\Users\LENOVO\.m2\repository\jakarta\persistence\jakarta.persistence-api\2.2.3\jakarta.persistence-api-2.2.3.jar;C:\Users\LENOVO\.m2\repository\jakarta\transaction\jakarta.transaction-api\1.3.3\jakarta.transaction-api-1.3.3.jar;C:\Users\LENOVO\.m2\repository\org\hibernate\hibernate-core\5.4.9.Final\hibernate-core-5.4.9.Final.jar;C:\Users\LENOVO\.m2\repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;C:\Users\LENOVO\.m2\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;C:\Users\LENOVO\.m2\repository\net\bytebuddy\byte-buddy\1.10.4\byte-buddy-1.10.4.jar;C:\Users\LENOVO\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\LENOVO\.m2\repository\org\jboss\jandex\2.1.1.Final\jandex-2.1.1.Final.jar;C:\Users\LENOVO\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\Users\LENOVO\.m2\repository\org\dom4j\dom4j\2.1.1\dom4j-2.1.1.jar;C:\Users\LENOVO\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.1.0.Final\hibernate-commons-annotations-5.1.0.Final.jar;C:\Users\LENOVO\.m2\repository\org\glassfish\jaxb\jaxb-runtime\2.3.2\jaxb-runtime-2.3.2.jar;C:\Users\LENOVO\.m2\repository\org\glassfish\jaxb\txw2\2.3.2\txw2-2.3.2.jar;C:\Users\LENOVO\.m2\repository\com\sun\istack\istack-commons-runtime\3.0.8\istack-commons-runtime-3.0.8.jar;C:\Users\LENOVO\.m2\repository\org\jvnet\staxex\stax-ex\1.8.1\stax-ex-1.8.1.jar;C:\Users\LENOVO\.m2\repository\com\sun\xml\fastinfoset\FastInfoset\1.2.16\FastInfoset-1.2.16.jar;C:\Users\LENOVO\.m2\repository\org\springframework\data\spring-data-jpa\2.2.3.RELEASE\spring-data-jpa-2.2.3.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\data\spring-data-commons\2.2.3.RELEASE\spring-data-commons-2.2.3.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-orm\5.2.2.RELEASE\spring-orm-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-tx\5.2.2.RELEASE\spring-tx-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\slf4j\slf4j-api\1.7.29\slf4j-api-1.7.29.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-aspects\5.2.2.RELEASE\spring-aspects-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.1.1\mybatis-spring-boot-starter-2.1.1.jar;C:\Users\LENOVO\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.1.1\mybatis-spring-boot-autoconfigure-2.1.1.jar;C:\Users\LENOVO\.m2\repository\org\mybatis\mybatis\3.5.3\mybatis-3.5.3.jar;C:\Users\LENOVO\.m2\repository\org\mybatis\mybatis-spring\2.0.3\mybatis-spring-2.0.3.jar;C:\Users\LENOVO\.m2\repository\com\baomidou\mybatis-plus\2.3\mybatis-plus-2.3.jar;C:\Users\LENOVO\.m2\repository\com\baomidou\mybatis-plus-support\2.3\mybatis-plus-support-2.3.jar;C:\Users\LENOVO\.m2\repository\com\baomidou\mybatis-plus-core\2.3\mybatis-plus-core-2.3.jar;C:\Users\LENOVO\.m2\repository\com\github\jsqlparser\jsqlparser\1.1\jsqlparser-1.1.jar;C:\Users\LENOVO\.m2\repository\com\baomidou\mybatis-plus-generate\2.3\mybatis-plus-generate-2.3.jar;C:\Users\LENOVO\.m2\repository\mysql\mysql-connector-java\8.0.18\mysql-connector-java-8.0.18.jar;C:\Users\LENOVO\.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.2.0.jre8\mssql-jdbc-6.2.0.jre8.jar;C:\Users\LENOVO\.m2\repository\org\springframework\boot\spring-boot-starter-security\2.2.2.RELEASE\spring-boot-starter-security-2.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-aop\5.2.2.RELEASE\spring-aop-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\security\spring-security-config\5.2.1.RELEASE\spring-security-config-5.2.1.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\security\spring-security-core\5.2.1.RELEASE\spring-security-core-5.2.1.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\security\spring-security-web\5.2.1.RELEASE\spring-security-web-5.2.1.RELEASE.jar;C:\Users\LENOVO\.m2\repository\io\jsonwebtoken\jjwt\0.9.1\jjwt-0.9.1.jar;C:\Users\LENOVO\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.10.1\jackson-databind-2.10.1.jar;C:\Users\LENOVO\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.10.1\jackson-annotations-2.10.1.jar;C:\Users\LENOVO\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.10.1\jackson-core-2.10.1.jar;C:\Users\LENOVO\.m2\repository\cn\hutool\hutool-all\4.0.12\hutool-all-4.0.12.jar;C:\Users\LENOVO\.m2\repository\com\alibaba\fastjson\1.2.8\fastjson-1.2.8.jar;C:\Users\LENOVO\.m2\repository\org\apache\commons\commons-lang3\3.0\commons-lang3-3.0.jar;C:\Users\LENOVO\.m2\repository\commons-io\commons-io\2.5\commons-io-2.5.jar;C:\Users\LENOVO\.m2\repository\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;C:\Users\LENOVO\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\LENOVO\.m2\repository\com\baidu\aip\java-sdk\4.4.1\java-sdk-4.4.1.jar;C:\Users\LENOVO\.m2\repository\org\json\json\20160810\json-20160810.jar;C:\Users\LENOVO\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Users\LENOVO\.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.2\jakarta.xml.bind-api-2.3.2.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-core\5.2.2.RELEASE\spring-core-5.2.2.RELEASE.jar;C:\Users\LENOVO\.m2\repository\org\springframework\spring-jcl\5.2.2.RELEASE\spring-jcl-5.2.2.RELEASE.jar com.example.health.drug.HealthDrugApplication 2025-06-24 15:25:40.966 INFO 25564 --- [ main] c.e.health.drug.HealthDrugApplication : Starting HealthDrugApplication on DESKTOP-T4O08EV with PID 25564 (started by LENOVO in D:\study\计算机工程课设\medicine_management) 2025-06-24 15:25:40.968 INFO 25564 --- [ main] c.e.health.drug.HealthDrugApplication : No active profile set, falling back to default profiles: default 2025-06-24 15:25:41.398 INFO 25564 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2025-06-24 15:25:41.444 INFO 25564 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 40ms. Found 2 JPA repository interfaces. 2025-06-24 15:25:41.518 WARN 25564 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.example.health.drug]' package. Please check your configuration. 2025-06-24 15:25:41.682 INFO 25564 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-06-24 15:25:41.807 INFO 25564 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2025-06-24 15:25:41.812 INFO 25564 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2025-06-24 15:25:41.812 INFO 25564 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.29] 2025-06-24 15:25:41.938 INFO 25564 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2025-06-24 15:25:41.938 INFO 25564 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 948 ms 2025-06-24 15:25:41.946 ERROR 25564 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'jwtAuthFilter' defined in file [D:\study\计算机工程课设\medicine_management\target\classes\com\example\health\drug\security\JwtAuthFilter.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.core.userdetails.UserDetailsService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 2025-06-24 15:25:41.956 INFO 25564 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2025-06-24 15:25:41.970 WARN 25564 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat 2025-06-24 15:25:41.974 INFO 25564 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2025-06-24 15:25:42.016 ERROR 25564 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Parameter 1 of constructor in com.example.health.drug.security.JwtAuthFilter required a bean of type 'org.springframework.security.core.userdetails.UserDetailsService' that could not be found. The following candidates were found but could not be injected: - Bean method 'inMemoryUserDetailsManager' in 'UserDetailsServiceAutoConfiguration' not loaded because @ConditionalOnBean (types: org.springframework.security.authentication.AuthenticationManager,org.springframework.security.authentication.AuthenticationProvider,org.springframework.security.core.userdetails.UserDetailsService,org.springframework.security.oauth2.jwt.JwtDecoder,org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector; SearchStrategy: all) found beans of type 'org.springframework.security.authentication.AuthenticationManager' authenticationManagerBean Action: Consider revisiting the entries above or defining a bean of type 'org.springframework.security.core.userdetails.UserDetailsService' in your configuration. 进程已结束,退出代码为 1
06-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值