DispatcherServlet 请求处理主逻辑 : 2. 选择 Handler 对应的 HandlerAdapter

本文解析了SpringMVC框架中DispatcherServlet如何通过HandlerAdapter执行Handler处理请求的机制,介绍了HandlerAdapter的作用、来源及判断标准,阐述了其对DispatcherServlet扩展性的影响。

该系列上一篇 : DispatcherServlet 请求处理主逻辑 : 1. 选择 Handler

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

DispatcherServlet请求处理主逻辑在找到能处理当前请求的handler之后,接下来就需要执行该Handler以处理请求了。那么,DispatcherServlet是直接执行该Handler吗?非也。这里Spring MVC引入了HandlerAdapter的概念。在Spring MVCHandlerAdapter是一个接口,该接口会被针对各种Handler类型实现以处理各种请求。实际上,DispatcherServlet请求处理过程中,执行Handler处理请求是通过HandlerAdapter完成的,而并非是DispatcherServlet直接调用Handler提供的处理方法。

那么为什么要有一层HandlerAdapter呢?这是为了使DispatcherServlet具备更强的扩展性,并隔离DispatcherServlet的请求处理主流程逻辑和具体的handler调用细节。当要支持更多的Handler类型时,可以实现相应的HandlerAdapter隐藏具体的Handler调用细节,而DispatcherServlet只需要找到相应的Handler类型的HandlerAdapter使用统一的方式就可以完成对请求的处理,从而以不变应万变。

接下来我们看DispatcherServlet请求处理主流程根据handler获取相应的HandlerAdapter的调用语句:

// Determine handler adapter for the current request.
HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());

此处可见,获得相应HandlerAdapter的逻辑是由getHandlerAdapter方法提供的。源代码如下所示 :

	/**
	 * Return the HandlerAdapter for this handler object.
	 * @param handler the handler object to find an adapter for
	 * @throws ServletException if no HandlerAdapter can be found for the handler. 
     * This is a fatal error.
	 */
	protected HandlerAdapter getHandlerAdapter(Object handler) throws ServletException {
		if (this.handlerAdapters != null) {
			for (HandlerAdapter adapter : this.handlerAdapters) {
				if (adapter.supports(handler)) {
					return adapter;
				}
			}
		}
		throw new ServletException("No adapter for handler [" + handler +
		"]: The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler");
	}

getHandlerAdapter方法实现并无难懂之处。主要就是在属性this.handlerAdapters不为null时遍历其中保存的每个HandlerAdapter,看它能不能支持给定Handler。而能不能支持某种Handler,是由HandlerAdapter实现类自己决定的。这里如果被遍历到的HandlerAdapter支持参数Handler的话,getHandlerAdapter方法就返回相应的HandlerAdapter,这也就是最终要应用于执行Handler处理当前请求的HandlerAdapter了。不过,从该逻辑也可以看出,如果找不到能支持该HandlerHandlerAdapter,它会抛出异常ServletException声明这是一个配置错误。缺省情况下,框架对所有支持的Handler类型都提供了相应的HandlerAdapter支持,所以通常该异常分支并不会被执行到。但是如果开发人员提供了自定义的某种handler,但是又没有提供对应的HandlerAdapter支持,该异常分支就有可能被执行。

在这里,你可能会问另外一个问题,属性this.handlerAdapters内的信息又是从哪里来的呢?其实,这些信息是在DispatcherServlet初始化过程中进行的,具体可以参考 : Spring MVC DispatcherServlet 策略初始化 – initHandlerAdapters

Spring MVC框架在配置过程中提供了多种HandlerAdapter以支持不同的Handler类型,具体可以参考:

  1. Spring MVC : WebMvcConfigurationSupport 中定义的 HandlerAdapter 组件
  2. Spring MVC : 框架提供的 HandlerAdapter 实现

总结

本文梳理了DispatcherServlet根据Handler之后获取相应的HandlerAdapter的过程,包含如下要点 :

  • HandlerAdapter是什么 ?
  • 这些HandlerAdapter从哪里来 ?
  • 如何判断一个HandlerAdapter是否支持某个Handler ?
  • 已经有了Handler,为什么还要使用HandlerAdapter ?
  • 如果找不到HandlerHandlerAdapter会怎么样 ?
  • 有哪些类型的HandlerAdapter?

相关文章

2025-10-22 22:31:38 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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 '/mchange-commons.properties' 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 '/mchange-log.properties' 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 '/c3p0.properties' 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 'hocon:/reference,/application,/c3p0,/' 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): 'ro******'. 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='111', email=11111}]jgeydugwu 2025-10-22 22:31:56 DEBUG DefaultListableBeanFactory:1631 - Invoking afterPropertiesSet() on bean with name 'userList' 2025-10-22 22:31:56 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:31:56 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:31:56 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:31:56 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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='111', email=11111}]jgeydugwu 2025-10-22 22:32:09 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:32:09 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:32:09 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:32:09 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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='111', email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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='111', email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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='111', email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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='111', email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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='111', email=11111}]jgeydugwu 2025-10-22 22:32:10 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:32:10 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:32:10 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:32:10 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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 'springMVC' 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 'userController' 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='111', email=11111}]jgeydugwu 2025-10-22 22:32:11 DEBUG DispatcherServlet:1251 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'userList'; URL [/userList.html]] in DispatcherServlet with name 'springMVC' 2025-10-22 22:32:11 DEBUG JstlView:432 - Added model object 'user' of type [java.util.ArrayList] to request in view with name 'userList' 2025-10-22 22:32:11 DEBUG JstlView:166 - Forwarding to resource [/userList.html] in InternalResourceView 'userList' 2025-10-22 22:32:11 DEBUG DispatcherServlet:865 - DispatcherServlet with name 'springMVC' 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 'springMVC': 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值