DispatcherServlet 请求处理主逻辑 : 3. 通过 HandlerAdapter 执行 Handler

本文详细解析了SpringMVC中DispatcherServlet如何使用HandlerAdapter执行Handler处理请求的流程,包括前置拦截、请求处理、视图应用及后置拦截等关键步骤。

该系列上一篇 : DispatcherServlet 请求处理主逻辑 : 2. 选择 Handler 对应的 HandlerAdapter

本文代码版本 : spring-webmvc-5.1.5.RELEASE

DispatcherServlet请求处理主逻辑(#doDispatch)找到针对当前请求的Handler以及HandlerAdapter之后,就是使用HandlerAdapter执行该Handler从而处理当前请求了。相应的调用语句如下:

// 1. 这里 mappedHandler 是所找到的 Handler, 类型为 HandlerExecutionChain
// 相当于 : N HandlerInterceptor 包裹一个 Handler
// 2. 这里 mv 是一个类型为 ModelAndView 的对象
// 3. 这里 ha 是所找到的 HandlerAdapter

// 在调用 Handler 处理请求之前,应用各个 HandlerInterceptor 的前置拦截处理逻辑  preHandle 
if (!mappedHandler.applyPreHandle(processedRequest, response)) {
	return;
}

// 各个HandlerInterceptor#preHandle前置处理逻辑应用完成且都返回true,
// 现在需要通过 ha 调用相应的 Handler 了
// Actually invoke the handler.
mv = ha.handle(processedRequest, response, mappedHandler.getHandler());
// 注意 : 这里 mv 存在为 null 的情况,比如开发人员在控制器方法上使用了
// @ResponseBody, 则最终返回给客户端的是JSON/XML之类的数据,而不需要
// 视图渲染,此时 mv 就会为 null。不过这种情况下虽然 mv 为null,当前
// 处理流程并不会结束,还是会继续,但下面的步骤会考虑该情况进行相应的处理。

// 这里有一些异步处理相关的代码,为了方便描述请求处理主逻辑,这里将其删除
// ... 

// 通过 ha 调用相应的 Handler 处理请求结束,现在对处理结果 mv 做个微调 :
// 如果 mv 中不含视图,并且能找到一个处理该请求的默认视图,则将该默认视图
// 设置到 mv 中
applyDefaultViewName(processedRequest, mv);

// 现在已经使用 Handler 处理了请求,结果是 mv 并且已经做了是否应用默认视图的微调,
// 现在需要应用各个 HandlerInterceptor 的后置拦截处理逻辑 postHandle 了
mappedHandler.applyPostHandle(processedRequest, response, mv);

概括来讲,上面使用HandlerAdapter执行该Handler处理请求的逻辑主要分为4个小步骤 :

  1. 应用各个HandlerInterceptor的前置拦截处理逻辑preHandle;
  2. 使用HandlerAdapter执行Handler以处理请求,返回结果ModelAndView mv;
  3. 对结果mv做是否应用默认视图的调整;
  4. 应用各个HandlerInterceptor的后置拦截处理逻辑postHandle;

接下来,我们继续深入,看看以上各个小步骤都做了些什么 。

1. 应用前置拦截处理逻辑

// 	类 HandlerExecutionChain 代码片段
    /**
	 * Apply preHandle methods of registered interceptors.
	 * @return true if the execution chain should proceed with the
	 * next interceptor or the handler itself. Else, DispatcherServlet assumes
	 * that this interceptor has already dealt with the response itself.
	 */
	boolean applyPreHandle(HttpServletRequest request, HttpServletResponse response) throws Exception {
		HandlerInterceptor[] interceptors = getInterceptors();
		if (!ObjectUtils.isEmpty(interceptors)) {
			for (int i = 0; i < interceptors.length; i++) {
				HandlerInterceptor interceptor = interceptors[i];
				if (!interceptor.preHandle(request, response, this.handler)) {
					triggerAfterCompletion(request, response, null);
					return false;
				}
				this.interceptorIndex = i;
			}
		}
		return true;
	}

2. 执行Handler处理请求

这个小步骤的逻辑是使用HandlerAdapter执行Handler以处理请求,返回结果ModelAndView mv。至于执行的细节,要取决于HandlerAdapter实现类。如果对此想了解更多,可以参考一下Spring MVC HandlerAdapter : 控制器方法适配器 RequestMappingHandlerAdapter,这是一个针对控制器方法的HandlerAdapter,换句话讲,开发人员通过@Controller注解定义的类中使用了@RequestMapping注解这样的方法,都是通过RequestMappingHandlerAdapter来执行的。

3. 检查是否需要应用缺省视图

	/**
	 * Do we need view name translation?
	 */
	private void applyDefaultViewName(HttpServletRequest request, @Nullable ModelAndView mv) throws Exception {
		if (mv != null && !mv.hasView()) {
			String defaultViewName = getDefaultViewName(request);
			if (defaultViewName != null) {
				mv.setViewName(defaultViewName);
			}
		}
	}

4. 应用后置拦截处理逻辑

// 	类 HandlerExecutionChain 代码片段
	/**
	 * Apply postHandle methods of registered interceptors.
	 */
	void applyPostHandle(HttpServletRequest request, HttpServletResponse response, @Nullable ModelAndView mv)
			throws Exception {

		HandlerInterceptor[] interceptors = getInterceptors();
		if (!ObjectUtils.isEmpty(interceptors)) {
			for (int i = interceptors.length - 1; i >= 0; i--) {
				HandlerInterceptor interceptor = interceptors[i];
				interceptor.postHandle(request, response, this.handler, mv);
			}
		}
	}

通过上面的分析,我们可以看到DispatcherServlet请求处理主逻辑是如何使用各个组件协调完成请求处理的。并且,使用HandlerAdapter执行Handler处理完请求之后,输出的结果是一个ModelAndView mv,该对象持有两部分信息 :

  1. 用于渲染视图的数据,也就是Model;
  2. 视图View,可能是View对象,也可能是View的名称;
    该结果会被DispatcherServlet请求处理主逻辑下一步骤消费用于生成最终返回给客户端的视图数据。

上面的分析仅限于没有遇到异常的情况,那么,如果遇到了异常,又会怎样呢?实际上,以上步骤调用被一个try块包围,一旦遇到Exception,或者是Throwable,最终都会catch捕获并包装成一个异常对象(变量名称使用dispatchException),该异常对象dispatchException和上面提到的mv一样,也会提供给下一步骤的处理逻辑使用。

相关文章

2025-10-22 22:31:38 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/] 2025-10-22 22:31:38 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /index.html 2025-10-22 22:31:38 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/index.html] 2025-10-22 22:31:38 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/index.html] are [/**] 2025-10-22 22:31:38 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/index.html] are {} 2025-10-22 22:31:38 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/index.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:31:38 DEBUG DispatcherServlet:951 - Last-Modified value for [/] is: -1 2025-10-22 22:31:38 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:31:38 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:31:55 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:31:55 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:31:55 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:31:55 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:31:55 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:31:55.701 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:31:55.707 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3b91154] was not registered for synchronization because synchronization is not active 2025-10-22 22:31:55 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:31:55.750 [http-nio-8080-exec-9] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1hgeirabe3f6je32dl1po|4b58de13, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgeirabe3f6je32dl1po|4b58de13, idleConnectionTestPeriod -> 300, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/as3?serverTimezone=UTC&seUnicode=true&characterEncoding=utf8&useSSL=false, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] 22:31:55.766 [http-nio-8080-exec-9] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier &#39;/mchange-commons.properties&#39; could not be found. Skipping. 22:31:55.766 [http-nio-8080-exec-9] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier &#39;/mchange-log.properties&#39; could not be found. Skipping. 22:31:55.766 [http-nio-8080-exec-9] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier &#39;/c3p0.properties&#39; could not be found. Skipping. 22:31:55.766 [http-nio-8080-exec-9] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier &#39;hocon:/reference,/application,/c3p0,/&#39; could not be found. Skipping. 22:31:55.766 [http-nio-8080-exec-9] WARN com.mchange.v2.resourcepool.BasicResourcePool - Bad pool size config, start 3 < min 5. Using 5 as start. 22:31:55.768 [http-nio-8080-exec-9] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - com.mchange.v2.resourcepool.BasicResourcePool@2541f640 config: [start -> 5; min -> 5; max -> 20; inc -> 3; num_acq_attempts -> 30; acq_attempt_delay -> 1000; check_idle_resources_delay -> 300000; max_resource_age -> 0; max_idle_time -> 0; excess_max_idle_time -> 0; destroy_unreturned_resc_time -> 0; expiration_enforcement_delay -> 0; break_on_acquisition_failure -> false; debug_store_checkout_exceptions -> false; force_synchronous_checkins -> false] 22:31:55.768 [http-nio-8080-exec-9] DEBUG com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager - Created new pool for auth, username (masked): &#39;ro******&#39;. 22:31:55.768 [http-nio-8080-exec-9] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - acquire test -- pool size: 0; target_pool_size: 5; desired target? 1 22:31:55.768 [http-nio-8080-exec-9] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - awaitAvailable(): [unknown] 22:31:55.997 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@f47a4d7 [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:31:56.003 [http-nio-8080-exec-9] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:31:56.026 [http-nio-8080-exec-9] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:31:56.050 [http-nio-8080-exec-9] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:31:56.054 [http-nio-8080-exec-9] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3b91154] 2025-10-22 22:31:56 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:31:56 DEBUG DefaultListableBeanFactory:1631 - Invoking afterPropertiesSet() on bean with name &#39;userList&#39; 2025-10-22 22:31:56 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:31:56 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:31:56 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:31:56 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:31:56 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:31:56 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:31:56 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:31:56 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:31:56 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:31:56 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:31:56 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:31:56 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:31:56 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:09 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:32:09 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:32:09 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:32:09 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:32:09 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:32:09.397 [http-nio-8080-exec-7] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:32:09.397 [http-nio-8080-exec-7] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1459739] was not registered for synchronization because synchronization is not active 2025-10-22 22:32:09 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:32:09.398 [http-nio-8080-exec-7] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@bbdfc49 [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:32:09.398 [http-nio-8080-exec-7] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:32:09.398 [http-nio-8080-exec-7] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:32:09.399 [http-nio-8080-exec-7] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:32:09.399 [http-nio-8080-exec-7] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1459739] 2025-10-22 22:32:09 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:32:09 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:32:09 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:32:09 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:32:09 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:32:09 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:32:09 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:32:09 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:32:09 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:32:09 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:32:09 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:32:09 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:32:09 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:09 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:32:10 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:32:10.118 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:32:10.119 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7cca23ef] was not registered for synchronization because synchronization is not active 2025-10-22 22:32:10 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:32:10.119 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@7632489f [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:32:10.119 [http-nio-8080-exec-8] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:32:10.119 [http-nio-8080-exec-8] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:32:10.120 [http-nio-8080-exec-8] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:32:10.120 [http-nio-8080-exec-8] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7cca23ef] 2025-10-22 22:32:10 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:32:10 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:32:10 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:32:10.320 [http-nio-8080-exec-10] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:32:10.320 [http-nio-8080-exec-10] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@774dded2] was not registered for synchronization because synchronization is not active 2025-10-22 22:32:10 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:32:10.320 [http-nio-8080-exec-10] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@7db5b5a2 [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:32:10.320 [http-nio-8080-exec-10] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:32:10.321 [http-nio-8080-exec-10] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:32:10.321 [http-nio-8080-exec-10] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:32:10.321 [http-nio-8080-exec-10] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@774dded2] 2025-10-22 22:32:10 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:32:10 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:32:10 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:32:10.509 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:32:10.509 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@69d48655] was not registered for synchronization because synchronization is not active 2025-10-22 22:32:10 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:32:10.509 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@3ad758c4 [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:32:10.509 [http-nio-8080-exec-2] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:32:10.509 [http-nio-8080-exec-2] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:32:10.510 [http-nio-8080-exec-2] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:32:10.510 [http-nio-8080-exec-2] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@69d48655] 2025-10-22 22:32:10 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:32:10 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:32:10 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:32:10.695 [http-nio-8080-exec-1] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:32:10.695 [http-nio-8080-exec-1] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@440a7656] was not registered for synchronization because synchronization is not active 2025-10-22 22:32:10 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:32:10.695 [http-nio-8080-exec-1] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@4ef21d26 [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:32:10.695 [http-nio-8080-exec-1] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:32:10.695 [http-nio-8080-exec-1] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:32:10.697 [http-nio-8080-exec-1] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:32:10.697 [http-nio-8080-exec-1] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@440a7656] 2025-10-22 22:32:10 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:32:10 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:32:10 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:32:10.903 [http-nio-8080-exec-3] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:32:10.903 [http-nio-8080-exec-3] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4f16f8e4] was not registered for synchronization because synchronization is not active 2025-10-22 22:32:10 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:32:10.903 [http-nio-8080-exec-3] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@fa43cca [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:32:10.903 [http-nio-8080-exec-3] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:32:10.904 [http-nio-8080-exec-3] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:32:10.905 [http-nio-8080-exec-3] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:32:10.905 [http-nio-8080-exec-3] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4f16f8e4] 2025-10-22 22:32:10 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:32:10 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:32:10 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:32:10 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:32:10 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:10 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:11 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/user/list] 2025-10-22 22:32:11 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /user/list 2025-10-22 22:32:11 DEBUG RequestMappingHandlerMapping:317 - Returning handler method [public java.lang.String com.yourcompany.controller.UserController.getUserList(org.springframework.ui.Model)] 2025-10-22 22:32:11 DEBUG DefaultListableBeanFactory:251 - Returning cached instance of singleton bean &#39;userController&#39; 2025-10-22 22:32:11 DEBUG DispatcherServlet:951 - Last-Modified value for [/user/list] is: -1 22:32:11.112 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 22:32:11.112 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5d865fa1] was not registered for synchronization because synchronization is not active 2025-10-22 22:32:11 DEBUG DataSourceUtils:110 - Fetching JDBC Connection from DataSource 22:32:11.112 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [com.mchange.v2.c3p0.impl.NewProxyConnection@6ff6baeb [wrapping: com.mysql.jdbc.JDBC4Connection@2121fc6a]] will not be managed by Spring 22:32:11.112 [http-nio-8080-exec-5] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Preparing: SELECT * FROM users 22:32:11.112 [http-nio-8080-exec-5] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - ==> Parameters: 22:32:11.113 [http-nio-8080-exec-5] DEBUG com.yourcompany.dao.UserMapper.getAllUsers - <== Total: 1 22:32:11.113 [http-nio-8080-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5d865fa1] 2025-10-22 22:32:11 DEBUG DataSourceUtils:327 - Returning JDBC Connection to DataSource [User{id=1, name=&#39;111&#39;, email=11111}]jgeydugwu 2025-10-22 22:32:11 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name &#39;userList&#39;; URL [/userList.html]] in DispatcherServlet with name &#39;springMVC&#39; 2025-10-22 22:32:11 DEBUG JstlView:432 - Added model object &#39;user&#39; of type [java.util.ArrayList] to request in view with name &#39;userList&#39; 2025-10-22 22:32:11 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView &#39;userList&#39; 2025-10-22 22:32:11 DEBUG DispatcherServlet:865 - DispatcherServlet with name &#39;springMVC&#39; processing GET request for [/userList.html] 2025-10-22 22:32:11 DEBUG RequestMappingHandlerMapping:310 - Looking up handler method for path /userList.html 2025-10-22 22:32:11 DEBUG RequestMappingHandlerMapping:320 - Did not find handler method for [/userList.html] 2025-10-22 22:32:11 DEBUG SimpleUrlHandlerMapping:190 - Matching patterns for request [/userList.html] are [/**] 2025-10-22 22:32:11 DEBUG SimpleUrlHandlerMapping:219 - URI Template variables for request [/userList.html] are {} 2025-10-22 22:32:11 DEBUG SimpleUrlHandlerMapping:140 - Mapping [/userList.html] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/WEB-INF/views/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@2d8a68cc]]] and 1 interceptor 2025-10-22 22:32:11 DEBUG DispatcherServlet:951 - Last-Modified value for [/userList.html] is: -1 2025-10-22 22:32:11 DEBUG DispatcherServlet:1044 - Null ModelAndView returned to DispatcherServlet with name &#39;springMVC&#39;: assuming HandlerAdapter completed request handling 2025-10-22 22:32:11 DEBUG DispatcherServlet:1000 - Successfully completed request 2025-10-22 22:32:11 DEBUG DispatcherServlet:1000 - Successfully completed request
最新发布
10-23
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值