为什么Spring引导使用来自不同包的线程来处理请求?

Car*_*cas 3 java spring spring-mvc spring-security spring-boot

所以,我只是按照本教程来设置一些基本的身份验证.

在查看日志时,我有一个关于最新情况的问题.这是日志片段:

2015-08-24 23:08:22.690  INFO 9732 --- [nio-8080-exec-3] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:08:22 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 408B23D5ED14118ABBC514260B915F5D}]
2015-08-24 23:08:22.691  INFO 9732 --- [nio-8080-exec-3] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:08:22 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 408B23D5ED14118ABBC514260B915F5D}]
2015-08-24 23:08:22.693  INFO 9732 --- [nio-8080-exec-3] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:08:22 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 408B23D5ED14118ABBC514260B915F5D}]
2015-08-24 23:09:50.033  INFO 9732 --- [io-8080-exec-10] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:09:50 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffde5d4: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 052AA17446027B428C10624F146B0D84}]
2015-08-24 23:09:50.035  INFO 9732 --- [io-8080-exec-10] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:09:50 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffde5d4: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 052AA17446027B428C10624F146B0D84}]
2015-08-24 23:09:50.037  INFO 9732 --- [io-8080-exec-10] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Mon Aug 24 23:09:50 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@fffde5d4: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 052AA17446027B428C10624F146B0D84}]
Run Code Online (Sandbox Code Playgroud)

为了生成这些日志,我所做的只是登录/退出两次.我的问题是,为什么第二次尝试使用不同类型的线程?我第一次登录时使用了一个nio线程,第二次使用了一个io线程.有关为什么会发生这种情况或如何配置它的任何信息都会很棒.

And*_*son 7

Spring Boot的默认日志模式允许15个字符作为线程的名称.当名称太长时,它会通过从头开始删除字符来缩短名称的长度.nio-8080-exec-10是16个字符长,所以删除第一个字符io-8080-exec-10.