From 2f4bf982a6fb85c4936f1d7f04c7d0a81264fe6f Mon Sep 17 00:00:00 2001 From: Soroosh Taefi Date: Thu, 5 Dec 2024 13:36:32 +0200 Subject: [PATCH] fix!: rename Hilla's endpointObjectMapper to prevent bean name clashes (#2956) fix: rename endpointObjectMapper to hillaEndpointObjectMapper Having Hilla related beans prefixed with hilla prevents clash with other framework or user beans. Fixes #2955 --- .../EndpointControllerConfiguration.java | 20 ++++++++++--------- .../signals/config/SignalsConfiguration.java | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointControllerConfiguration.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointControllerConfiguration.java index bba4523d10..3949492baf 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointControllerConfiguration.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointControllerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2023 Vaadin Ltd. + * Copyright 2000-2024 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -76,7 +76,7 @@ AccessAnnotationChecker accessAnnotationChecker() { * Registers a default {@link EndpointAccessChecker} bean instance. * * @param accessAnnotationChecker - * the access controlks checker to use + * the access controls checker to use * @return the default Vaadin endpoint access checker bean */ @Bean @@ -112,7 +112,8 @@ CsrfChecker csrfChecker(ServletContext servletContext) { * qualifier to override the mapper. */ @Bean - ObjectMapper endpointObjectMapper(ApplicationContext applicationContext, + ObjectMapper hillaEndpointObjectMapper( + ApplicationContext applicationContext, @Autowired(required = false) @Qualifier(EndpointController.ENDPOINT_MAPPER_FACTORY_BEAN_QUALIFIER) JacksonObjectMapperFactory endpointMapperFactory) { if (this.endpointMapper == null) { this.endpointMapper = endpointMapperFactory != null @@ -139,7 +140,7 @@ private static ObjectMapper createDefaultEndpointMapper( * * @param applicationContext * The Spring application context - * @param endpointObjectMapper + * @param hillaEndpointObjectMapper * ObjectMapper instance that is used for Hilla endpoints' * serializing and deserializing request and response bodies. * @param explicitNullableTypeChecker @@ -154,11 +155,12 @@ private static ObjectMapper createDefaultEndpointMapper( */ @Bean EndpointInvoker endpointInvoker(ApplicationContext applicationContext, - ObjectMapper endpointObjectMapper, + ObjectMapper hillaEndpointObjectMapper, ExplicitNullableTypeChecker explicitNullableTypeChecker, ServletContext servletContext, EndpointRegistry endpointRegistry) { - return new EndpointInvoker(applicationContext, endpointObjectMapper, - explicitNullableTypeChecker, servletContext, endpointRegistry); + return new EndpointInvoker(applicationContext, + hillaEndpointObjectMapper, explicitNullableTypeChecker, + servletContext, endpointRegistry); } /** @@ -275,9 +277,9 @@ private RequestMappingInfo prependEndpointPrefixUrl( } /** - * Can re-generate the TypeScipt code. + * Can re-generate the TypeScript code. * - * @param context + * @param servletContext * the servlet context * @param endpointController * the endpoint controller diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/signals/config/SignalsConfiguration.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/signals/config/SignalsConfiguration.java index 862bec0575..345b031608 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/signals/config/SignalsConfiguration.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/signals/config/SignalsConfiguration.java @@ -20,9 +20,9 @@ public class SignalsConfiguration { private final EndpointInvoker endpointInvoker; public SignalsConfiguration(EndpointInvoker endpointInvoker, - ObjectMapper endpointObjectMapper) { + ObjectMapper hillaEndpointObjectMapper) { this.endpointInvoker = endpointInvoker; - Signal.setMapper(endpointObjectMapper); + Signal.setMapper(hillaEndpointObjectMapper); } /**