考虑下面的代码片段 - 将简单的非线程安全 HashMap 传递给SomeHandlerFunction将在其他自动装配的 bean 中使用它的HashMap 是否安全SomeHandlerFunction?
@Bean
RouterFunction<ServerResponse> request(SomeHandlerFunction handlerFunction) {
handlerFunction.setSimpleMapProperties(new HashMap());
return route(GET("/dummy"), handlerFunction);
}
@Service
class SomeHandlerFunction implements HandlerFunction {
@Autowired
List<AnotherBeans> anotherBeans;
Mono<T> handle(ServerRequest var1) {
// code...
}
}
我有点了解 WebFlux 中的多线程模型,但是这个案例让我感到困惑。
qq_笑_17
手掌心
随时随地看视频慕课网APP
相关分类