NIO总结目录贴

老大不小了,一直想把java里面的几个盲点扫掉,一直拖到现在。必须行动了。立贴为证。

NIO的知识点其实也不多,关键是理解其原理,与操作系统的底层对应起来理解。与java BIO对照理解。

 

主要的知识点为:

Buffer

Channel

Selector

以及基于NIO开发的Mina,Netty等网络消息中间件的学习

 

一、缓冲区Buffer与通道Channel

http://kongxuan.iteye.com/blog/2024594

 

二、选择器Selector

 

三、Mina应用

 

四、Mina源码分析

 

五、基于Mina实现远程Rpc框架

 

既然选择了,就无需退缩,开始吧!

 

2025-09-23 17:45:21.057 [reactor-http-nio-6] DEBUG reactor.netty.http.server.HttpServerOperations - [5337afd7, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] New http connection, requesting read 2025-09-23 17:45:21.057 [reactor-http-nio-7] DEBUG reactor.netty.http.server.HttpServerOperations - [d4ca6b17, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] New http connection, requesting read 2025-09-23 17:45:21.057 [reactor-http-nio-6] DEBUG reactor.netty.transport.TransportConfig - [5337afd7, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] Initialized pipeline DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.left.httpTrafficHandler = reactor.netty.http.server.HttpTrafficHandler), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)} 2025-09-23 17:45:21.057 [reactor-http-nio-7] DEBUG reactor.netty.transport.TransportConfig - [d4ca6b17, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] Initialized pipeline DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.left.httpTrafficHandler = reactor.netty.http.server.HttpTrafficHandler), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)} 2025-09-23 17:45:21.058 [reactor-http-nio-7] DEBUG reactor.netty.http.server.HttpServerOperations - [d4ca6b17, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] Increasing pending responses, now 1 2025-09-23 17:45:21.059 [reactor-http-nio-6] DEBUG reactor.netty.http.server.HttpServerOperations - [5337afd7, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] Increasing pending responses, now 1 2025-09-23 17:45:21.059 [reactor-http-nio-7] DEBUG reactor.netty.http.server.HttpServer - [d4ca6b17-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter@44b58719 2025-09-23 17:45:21.059 [reactor-http-nio-6] DEBUG reactor.netty.http.server.HttpServer - [5337afd7-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter@44b58719 2025-09-23 17:45:21.059 [reactor-http-nio-7] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [d4ca6b17-5] HTTP POST "/master/shipper/query" 2025-09-23 17:45:21.059 [reactor-http-nio-6] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [5337afd7-6] HTTP POST "/master/shipper/query" 2025-09-23 17:45:21.059 [reactor-http-nio-7] DEBUG o.s.w.r.r.m.a.RequestMappingHandlerMapping - [d4ca6b17-5] Mapped to com.hvlink.controller.ShipperController#getShipper(ShipperParam) 2025-09-23 17:45:21.060 [reactor-http-nio-7] DEBUG o.s.w.r.r.m.a.RequestBodyMethodArgumentResolver - [d4ca6b17-5] Content-Type:application/json 2025-09-23 17:45:21.060 [reactor-http-nio-7] DEBUG o.s.w.r.r.m.a.RequestBodyMethodArgumentResolver - [d4ca6b17-5] 0..1 [com.hvlink.entity.param.master.ShipperParam] 2025-09-23 17:45:21.060 [reactor-http-nio-6] DEBUG o.s.w.r.r.m.a.RequestMappingHandlerMapping - [5337afd7-6] Mapped to com.hvlink.controller.ShipperController#getShipper(ShipperParam) 2025-09-23 17:45:21.060 [reactor-http-nio-7] DEBUG reactor.netty.channel.FluxReceive - [d4ca6b17-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] [terminated=false, cancelled=false, pending=0, error=null]: subscribing inbound receiver 2025-09-23 17:45:21.060 [reactor-http-nio-6] DEBUG o.s.w.r.r.m.a.RequestBodyMethodArgumentResolver - [5337afd7-6] Content-Type:application/json 2025-09-23 17:45:21.060 [reactor-http-nio-6] DEBUG o.s.w.r.r.m.a.RequestBodyMethodArgumentResolver - [5337afd7-6] 0..1 [com.hvlink.entity.param.master.ShipperParam] 2025-09-23 17:45:21.060 [reactor-http-nio-7] DEBUG o.s.http.codec.json.Jackson2JsonDecoder - [d4ca6b17-5] Decoded [ShipperParam(id=null, companyCode=null, supplierCode=null, supplierName=null, shipperName=null, isDe (truncated)...] 2025-09-23 17:45:21.061 [reactor-http-nio-6] DEBUG reactor.netty.channel.FluxReceive - [5337afd7-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] [terminated=false, cancelled=false, pending=0, error=null]: subscribing inbound receiver 2025-09-23 17:45:21.061 [reactor-http-nio-7] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 2025-09-23 17:45:21.061 [reactor-http-nio-7] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@20f5e83a] was not registered for synchronization because synchronization is not active 2025-09-23 17:45:21.061 [reactor-http-nio-6] DEBUG o.s.http.codec.json.Jackson2JsonDecoder - [5337afd7-6] Decoded [ShipperParam(id=null, companyCode=null, supplierCode=null, supplierName=null, shipperName=null, isDe (truncated)...] 2025-09-23 17:45:21.061 [reactor-http-nio-6] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 2025-09-23 17:45:21.061 [reactor-http-nio-6] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6bbfbaad] was not registered for synchronization because synchronization is not active 2025-09-23 17:45:21.071 [reactor-http-nio-7] DEBUG o.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 2025-09-23 17:45:21.075 [reactor-http-nio-6] DEBUG o.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 2025-09-23 17:45:21.193 [reactor-http-nio-6] DEBUG o.m.spring.transaction.SpringManagedTransaction - JDBC Connection [ConnectionID:3 ClientConnectionId: 7a9d2d6c-177a-4fab-a89f-958a3af6a3a5] will not be managed by Spring 2025-09-23 17:45:21.193 [reactor-http-nio-7] DEBUG o.m.spring.transaction.SpringManagedTransaction - JDBC Connection [ConnectionID:1 ClientConnectionId: 97cfcb9b-e9a5-41d0-b623-33fa9f4f4719] will not be managed by Spring 2025-09-23 17:45:21.194 [reactor-http-nio-6] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - ==> Preparing: SELECT COUNT(*) FROM (SELECT DISTINCT t.id, s.id AS supplier_id, t.supplier_code, s.supplier_name, t.shipper_name, t.is_default, t.create_time FROM tm_shipper t LEFT JOIN tm_supplier s ON s.supplier_code = t.supplier_code) TOTAL 2025-09-23 17:45:21.194 [reactor-http-nio-7] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - ==> Preparing: SELECT COUNT(*) FROM (SELECT DISTINCT t.id, s.id AS supplier_id, t.supplier_code, s.supplier_name, t.shipper_name, t.is_default, t.create_time FROM tm_shipper t LEFT JOIN tm_supplier s ON s.supplier_code = t.supplier_code) TOTAL 2025-09-23 17:45:21.194 [reactor-http-nio-6] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - ==> Parameters: 2025-09-23 17:45:21.194 [reactor-http-nio-7] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - ==> Parameters: 2025-09-23 17:45:21.289 [reactor-http-nio-7] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - <== Total: 1 2025-09-23 17:45:21.290 [reactor-http-nio-7] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - ==> Preparing: SELECT DISTINCT t.id, s.id as supplier_id, t.supplier_code, s.supplier_name, t.shipper_name, t.is_default, t.create_time FROM tm_shipper t LEFT JOIN tm_supplier s ON s.supplier_code = t.supplier_code ORDER BY t.create_time DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY 2025-09-23 17:45:21.290 [reactor-http-nio-7] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - ==> Parameters: 0(Long), 10(Long) 2025-09-23 17:45:21.294 [reactor-http-nio-6] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - <== Total: 1 2025-09-23 17:45:21.295 [reactor-http-nio-6] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - ==> Preparing: SELECT DISTINCT t.id, s.id as supplier_id, t.supplier_code, s.supplier_name, t.shipper_name, t.is_default, t.create_time FROM tm_shipper t LEFT JOIN tm_supplier s ON s.supplier_code = t.supplier_code ORDER BY t.create_time DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY 2025-09-23 17:45:21.295 [reactor-http-nio-6] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - ==> Parameters: 0(Long), 10(Long) 2025-09-23 17:45:21.392 [reactor-http-nio-7] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - <== Total: 10 2025-09-23 17:45:21.392 [reactor-http-nio-6] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - <== Total: 10 2025-09-23 17:45:21.392 [reactor-http-nio-7] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@20f5e83a] 2025-09-23 17:45:21.392 [reactor-http-nio-6] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6bbfbaad] 2025-09-23 17:45:21.392 [reactor-http-nio-6] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [5337afd7-6] Using 'application/json' given [application/json, text/plain, */*] and supported [application/json, application/*+json, application/x-ndjson, text/event-stream] 2025-09-23 17:45:21.392 [reactor-http-nio-7] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [d4ca6b17-5] Using 'application/json' given [application/json, text/plain, */*] and supported [application/json, application/*+json, application/x-ndjson, text/event-stream] 2025-09-23 17:45:21.392 [reactor-http-nio-6] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [5337afd7-6] 0..1 [com.hvlink.common.Result<com.hvlink.pagination.PageResult<com.hvlink.entity.vo.master.ShipperVO>>] 2025-09-23 17:45:21.392 [reactor-http-nio-7] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [d4ca6b17-5] 0..1 [com.hvlink.common.Result<com.hvlink.pagination.PageResult<com.hvlink.entity.vo.master.ShipperVO>>] 2025-09-23 17:45:21.393 [reactor-http-nio-7] DEBUG o.s.http.codec.json.Jackson2JsonEncoder - [d4ca6b17-5] Encoding [Result(status=200, msg=成功, data=PageResult(total=280, records=[ShipperVO(id=41, SupplierId=null, sup (truncated)...] 2025-09-23 17:45:21.393 [reactor-http-nio-6] DEBUG o.s.http.codec.json.Jackson2JsonEncoder - [5337afd7-6] Encoding [Result(status=200, msg=成功, data=PageResult(total=280, records=[ShipperVO(id=41, SupplierId=null, sup (truncated)...] 2025-09-23 17:45:21.394 [reactor-http-nio-7] DEBUG reactor.netty.http.server.HttpServerOperations - [d4ca6b17-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] Detected non persistent http connection, preparing to close 2025-09-23 17:45:21.394 [reactor-http-nio-6] DEBUG reactor.netty.http.server.HttpServerOperations - [5337afd7-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] Detected non persistent http connection, preparing to close 2025-09-23 17:45:21.394 [reactor-http-nio-7] DEBUG reactor.netty.http.server.HttpServerOperations - [d4ca6b17-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] Last HTTP packet was sent, terminating the channel 2025-09-23 17:45:21.394 [reactor-http-nio-6] DEBUG reactor.netty.http.server.HttpServerOperations - [5337afd7-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] Last HTTP packet was sent, terminating the channel 2025-09-23 17:45:21.394 [reactor-http-nio-7] DEBUG reactor.netty.channel.ChannelOperations - [d4ca6b17-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61870] [HttpServer] Channel inbound receiver cancelled (operation cancelled). 2025-09-23 17:45:21.394 [reactor-http-nio-6] DEBUG reactor.netty.channel.ChannelOperations - [5337afd7-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61869] [HttpServer] Channel inbound receiver cancelled (operation cancelled). 2025-09-23 17:45:21.396 [reactor-http-nio-7] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [d4ca6b17-5] Completed 200 OK 2025-09-23 17:45:21.396 [reactor-http-nio-6] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [5337afd7-6] Completed 200 OK 2025-09-23 17:45:21.507 [reactor-http-nio-8] DEBUG reactor.netty.http.server.HttpServerOperations - [61a722e4, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] New http connection, requesting read 2025-09-23 17:45:21.507 [reactor-http-nio-8] DEBUG reactor.netty.transport.TransportConfig - [61a722e4, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] Initialized pipeline DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.left.httpTrafficHandler = reactor.netty.http.server.HttpTrafficHandler), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)} 2025-09-23 17:45:21.509 [reactor-http-nio-8] DEBUG reactor.netty.http.server.HttpServerOperations - [61a722e4, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] Increasing pending responses, now 1 2025-09-23 17:45:21.509 [reactor-http-nio-8] DEBUG reactor.netty.http.server.HttpServer - [61a722e4-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter@44b58719 2025-09-23 17:45:21.509 [reactor-http-nio-8] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [61a722e4-7] HTTP POST "/master/shipper/query" 2025-09-23 17:45:21.510 [reactor-http-nio-8] DEBUG o.s.w.r.r.m.a.RequestMappingHandlerMapping - [61a722e4-7] Mapped to com.hvlink.controller.ShipperController#getShipper(ShipperParam) 2025-09-23 17:45:21.510 [reactor-http-nio-8] DEBUG o.s.w.r.r.m.a.RequestBodyMethodArgumentResolver - [61a722e4-7] Content-Type:application/json 2025-09-23 17:45:21.510 [reactor-http-nio-8] DEBUG o.s.w.r.r.m.a.RequestBodyMethodArgumentResolver - [61a722e4-7] 0..1 [com.hvlink.entity.param.master.ShipperParam] 2025-09-23 17:45:21.510 [reactor-http-nio-8] DEBUG reactor.netty.channel.FluxReceive - [61a722e4-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] [terminated=false, cancelled=false, pending=0, error=null]: subscribing inbound receiver 2025-09-23 17:45:21.511 [reactor-http-nio-8] DEBUG o.s.http.codec.json.Jackson2JsonDecoder - [61a722e4-7] Decoded [ShipperParam(id=null, companyCode=null, supplierCode=null, supplierName=, shipperName=, isDefault=nu (truncated)...] 2025-09-23 17:45:21.511 [reactor-http-nio-8] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession 2025-09-23 17:45:21.511 [reactor-http-nio-8] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@249d03d5] was not registered for synchronization because synchronization is not active 2025-09-23 17:45:21.516 [reactor-http-nio-8] DEBUG o.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 2025-09-23 17:45:21.517 [reactor-http-nio-8] DEBUG o.m.spring.transaction.SpringManagedTransaction - JDBC Connection [ConnectionID:3 ClientConnectionId: 7a9d2d6c-177a-4fab-a89f-958a3af6a3a5] will not be managed by Spring 2025-09-23 17:45:21.517 [reactor-http-nio-8] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - ==> Preparing: SELECT COUNT(*) FROM (SELECT DISTINCT t.id, s.id AS supplier_id, t.supplier_code, s.supplier_name, t.shipper_name, t.is_default, t.create_time FROM tm_shipper t LEFT JOIN tm_supplier s ON s.supplier_code = t.supplier_code) TOTAL 2025-09-23 17:45:21.517 [reactor-http-nio-8] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - ==> Parameters: 2025-09-23 17:45:21.693 [reactor-http-nio-8] DEBUG c.h.mapper.master.ShipperMapper.getShipper_mpCount - <== Total: 1 2025-09-23 17:45:21.694 [reactor-http-nio-8] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - ==> Preparing: SELECT DISTINCT t.id, s.id as supplier_id, t.supplier_code, s.supplier_name, t.shipper_name, t.is_default, t.create_time FROM tm_shipper t LEFT JOIN tm_supplier s ON s.supplier_code = t.supplier_code ORDER BY t.create_time DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY 2025-09-23 17:45:21.694 [reactor-http-nio-8] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - ==> Parameters: 0(Long), 10(Long) 2025-09-23 17:45:21.787 [reactor-http-nio-8] DEBUG com.hvlink.mapper.master.ShipperMapper.getShipper - <== Total: 10 2025-09-23 17:45:21.787 [reactor-http-nio-8] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@249d03d5] 2025-09-23 17:45:21.788 [reactor-http-nio-8] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [61a722e4-7] Using 'application/json' given [application/json, text/plain, */*] and supported [application/json, application/*+json, application/x-ndjson, text/event-stream] 2025-09-23 17:45:21.788 [reactor-http-nio-8] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [61a722e4-7] 0..1 [com.hvlink.common.Result<com.hvlink.pagination.PageResult<com.hvlink.entity.vo.master.ShipperVO>>] 2025-09-23 17:45:21.788 [reactor-http-nio-8] DEBUG o.s.http.codec.json.Jackson2JsonEncoder - [61a722e4-7] Encoding [Result(status=200, msg=成功, data=PageResult(total=280, records=[ShipperVO(id=41, SupplierId=null, sup (truncated)...] 2025-09-23 17:45:21.789 [reactor-http-nio-8] DEBUG reactor.netty.http.server.HttpServerOperations - [61a722e4-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] Detected non persistent http connection, preparing to close 2025-09-23 17:45:21.790 [reactor-http-nio-8] DEBUG reactor.netty.http.server.HttpServerOperations - [61a722e4-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] Last HTTP packet was sent, terminating the channel 2025-09-23 17:45:21.790 [reactor-http-nio-8] DEBUG reactor.netty.channel.ChannelOperations - [61a722e4-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61871] [HttpServer] Channel inbound receiver cancelled (operation cancelled). 2025-09-23 17:45:21.790 [reactor-http-nio-8] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [61a722e4-7] Completed 200 OK 2025-09-23 17:45:25.605 [reactor-http-nio-1] DEBUG reactor.netty.http.server.HttpServerOperations - [80f8cd8e, L:/192.168.10.122:9000 - R:/192.168.10.122:61872] New http connection, requesting read 2025-09-23 17:45:25.605 [reactor-http-nio-1] DEBUG reactor.netty.transport.TransportConfig - [80f8cd8e, L:/192.168.10.122:9000 - R:/192.168.10.122:61872] Initialized pipeline DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.left.httpTrafficHandler = reactor.netty.http.server.HttpTrafficHandler), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)} 2025-09-23 17:45:25.607 [reactor-http-nio-1] DEBUG reactor.netty.http.server.HttpServerOperations - [80f8cd8e, L:/192.168.10.122:9000 - R:/192.168.10.122:61872] Increasing pending responses, now 1 2025-09-23 17:45:25.607 [reactor-http-nio-1] DEBUG reactor.netty.http.server.HttpServer - [80f8cd8e-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61872] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter@44b58719 2025-09-23 17:45:25.607 [reactor-http-nio-1] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [80f8cd8e-8] HTTP POST "/master/shipperPart/listPartsWithStatus?supplierId=3&shipperId=28&spliceDesc=" 2025-09-23 17:45:25.607 [reactor-http-nio-1] DEBUG o.s.w.r.r.m.a.RequestMappingHandlerMapping - [80f8cd8e-8] Mapped to com.hvlink.controller.ShipperPartController#listPartsWithStatus(Integer, Integer, String, String) 2025-09-23 17:45:25.609 [reactor-http-nio-1] DEBUG org.springframework.web.method.HandlerMethod - [80f8cd8e-8] Could not resolve parameter [2] in public com.hvlink.common.Result<java.util.List<com.hvlink.entity.vo.master.PartVO>> com.hvlink.controller.ShipperPartController.listPartsWithStatus(java.lang.Integer,java.lang.Integer,java.lang.String,java.lang.String): 400 BAD_REQUEST "Required String parameter 'partCode' is not present" 2025-09-23 17:45:25.609 [reactor-http-nio-1] DEBUG o.s.w.r.r.m.a.RequestMappingHandlerAdapter - [80f8cd8e-8] Using @ExceptionHandler com.hvlink.exceptions.ExceptionHandle#handleException(Exception) 2025-09-23 17:45:25.611 [reactor-http-nio-1] ERROR com.hvlink.exceptions.ExceptionHandle - ===服务器内部错误== org.springframework.web.server.ServerWebInputException: 400 BAD_REQUEST "Required String parameter 'partCode' is not present" at org.springframework.web.reactive.result.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:114) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Assembly trace from producer [reactor.core.publisher.MonoSupplier] : reactor.core.publisher.Mono.fromSupplier(Mono.java:718) org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.getDefaultValue(AbstractNamedValueArgumentResolver.java:209) Error has been observed at the following site(s): *____Mono.fromSupplier ⇢ at org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.getDefaultValue(AbstractNamedValueArgumentResolver.java:209) *___Mono.switchIfEmpty ⇢ at org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.resolveArgument(AbstractNamedValueArgumentResolver.java:112) |_ Mono.defaultIfEmpty ⇢ at org.springframework.web.reactive.result.method.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:206) |_ Mono.doOnError ⇢ at org.springframework.web.reactive.result.method.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:207) *_____________Mono.zip ⇢ at org.springframework.web.reactive.result.method.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:214) |_ Mono.flatMap ⇢ at org.springframework.web.reactive.result.method.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:136) *___________Mono.defer ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:200) *____________Mono.then ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:200) |_ Mono.doOnNext ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:201) |_ Mono.doOnNext ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:202) Original Stack Trace: at org.springframework.web.reactive.result.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:114) at org.springframework.web.reactive.result.method.annotation.AbstractNamedValueArgumentResolver.lambda$getDefaultValue$1(AbstractNamedValueArgumentResolver.java:215) at reactor.core.publisher.MonoSupplier.subscribe(MonoSupplier.java:57) at reactor.core.publisher.Mono.subscribe(Mono.java:4490) at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:82) at reactor.core.publisher.Operators.complete(Operators.java:137) at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:145) at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53) at reactor.core.publisher.Mono.subscribe(Mono.java:4475) at reactor.core.publisher.MonoZip.subscribe(MonoZip.java:129) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:240) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:203) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onComplete(MonoFlatMap.java:181) at reactor.core.publisher.Operators.complete(Operators.java:137) at reactor.core.publisher.MonoZip.subscribe(MonoZip.java:121) at reactor.core.publisher.Mono.subscribe(Mono.java:4490) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:263) at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74) at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82) at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.java:282) at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:863) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:129) at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:180) at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2400) at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.request(MonoPeekTerminal.java:139) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171) at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2196) at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2070) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onSubscribe(MonoPeekTerminal.java:152) at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:55) at reactor.core.publisher.Mono.subscribe(Mono.java:4490) at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:451) at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.java:219) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:53) at reactor.core.publisher.Mono.subscribe(Mono.java:4490) at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:263) at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:55) at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) at reactor.netty.http.server.HttpServer$HttpServerHandle.onStateChange(HttpServer.java:1112) at reactor.netty.ReactorNetty$CompositeConnectionObserver.onStateChange(ReactorNetty.java:707) at reactor.netty.transport.ServerTransport$ChildObserver.onStateChange(ServerTransport.java:481) at reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:626) at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:230) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:750) 2025-09-23 17:45:25.611 [reactor-http-nio-1] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [80f8cd8e-8] Using 'application/json' given [application/json, text/plain, */*] and supported [application/json, application/*+json, application/x-ndjson, text/event-stream] 2025-09-23 17:45:25.611 [reactor-http-nio-1] DEBUG o.s.w.r.r.m.annotation.ResponseBodyResultHandler - [80f8cd8e-8] 0..1 [com.hvlink.common.Result<?>] 2025-09-23 17:45:25.612 [reactor-http-nio-1] DEBUG o.s.http.codec.json.Jackson2JsonEncoder - [80f8cd8e-8] Encoding [Result(status=500, msg=发现未知问题,请联系管理员!, data=null, timestamp=1758620725611)] 2025-09-23 17:45:25.613 [reactor-http-nio-1] DEBUG reactor.netty.http.server.HttpServerOperations - [80f8cd8e-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61872] Detected non persistent http connection, preparing to close 2025-09-23 17:45:25.613 [reactor-http-nio-1] DEBUG reactor.netty.http.server.HttpServerOperations - [80f8cd8e-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61872] Last HTTP packet was sent, terminating the channel 2025-09-23 17:45:25.613 [reactor-http-nio-1] DEBUG reactor.netty.channel.ChannelOperations - [80f8cd8e-1, L:/192.168.10.122:9000 - R:/192.168.10.122:61872] [HttpServer] Channel inbound receiver cancelled (operation cancelled). 2025-09-23 17:45:25.614 [reactor-http-nio-1] DEBUG o.s.web.server.adapter.HttpWebHandlerAdapter - [80f8cd8e-8] Completed 500 INTERNAL_SERVER_ERROR 我没有这个请求参数,为什么报错 <select id="selectPartsWithBindStatus" resultType="com.hvlink.entity.dto.master.ShipperPartDTO"> SELECT id, part_code, part_desc, supplier_code, assigned FROM ( SELECT p.id, p.part_code, p.part_desc, p.supplier_code, CASE WHEN sp.part_id IS NOT NULL THEN 1 ELSE 0 END AS assigned, ROW_NUMBER() OVER (PARTITION BY p.part_code ORDER BY p.id) AS rn FROM tm_part p LEFT JOIN tm_shipper_part sp ON p.id = sp.part_id AND sp.shipper_id = #{shipperId} WHERE p.supplier_code = ( SELECT supplier_code FROM tm_supplier WHERE id = #{supplierId} ) <if test="searchValue != null and searchValue != ''"> AND ( CONCAT(p.part_code, ' - ', p.part_desc) LIKE '%' + #{spliceDesc} + '%' ) </if> ) t WHERE rn = 1 ORDER BY part_code </select> /** * 查询供应商下的所有零件(包含绑定状态) */ @PostMapping("/listPartsWithStatus") public Result<List<PartVO>> listPartsWithStatus( @RequestParam Integer supplierId, @RequestParam Integer shipperId, @RequestParam String spliceDesc) { try { List<PartVO> parts = shipperPartService.listPartsWithStatus(supplierId, shipperId,spliceDesc); return Result.success(parts); } catch (Exception e) { log.error("查询零件列表失败 supplierId:{}, shipperId:{}", supplierId, shipperId, e); return Result.fail("查询失败"); } }
09-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值