Skip to content

Commit

Permalink
fix: adapt to Hilla API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollovati committed Nov 26, 2024
1 parent 0a87f04 commit 4fb69e4
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
import com.vaadin.hilla.ExplicitNullableTypeChecker;
import com.vaadin.hilla.auth.CsrfChecker;
import com.vaadin.hilla.auth.EndpointAccessChecker;
import com.vaadin.hilla.endpointransfermapper.EndpointTransferMapper;
import com.vaadin.hilla.parser.jackson.JacksonObjectMapperFactory;
import com.vaadin.hilla.route.RouteUnifyingConfigurationProperties;
import com.vaadin.hilla.route.RouteUtil;
import com.vaadin.hilla.signals.Signal;
import com.vaadin.hilla.signals.core.registry.SecureSignalsRegistry;
import com.vaadin.hilla.startup.EndpointRegistryInitializer;
import com.vaadin.hilla.startup.RouteUnifyingServiceInitListener;
Expand Down Expand Up @@ -143,13 +145,23 @@ EndpointRegistry endpointRegistry(EndpointNameChecker endpointNameChecker) {
@DefaultBean
EndpointInvoker endpointInvoker(
ApplicationContext applicationContext,
@Named(EndpointController.ENDPOINT_MAPPER_FACTORY_BEAN_QUALIFIER)
JacksonObjectMapperFactory objectMapperFactory,
@Named("endpointObjectMapper") ObjectMapper objectMapper,
ExplicitNullableTypeChecker explicitNullableTypeChecker,
ServletContext servletContext,
EndpointRegistry endpointRegistry) {
return new EndpointInvoker(
applicationContext, objectMapperFactory, explicitNullableTypeChecker, servletContext, endpointRegistry);
applicationContext, objectMapper, explicitNullableTypeChecker, servletContext, endpointRegistry);
}

@Produces
@Singleton
@Named("endpointObjectMapper")
ObjectMapper endpointObjectMapper(
@Named(EndpointController.ENDPOINT_MAPPER_FACTORY_BEAN_QUALIFIER)
JacksonObjectMapperFactory endpointMapperFactory) {
ObjectMapper mapper = endpointMapperFactory.build();
mapper.registerModule(new EndpointTransferMapper().getJacksonModule());
return mapper;
}

@Produces
Expand Down Expand Up @@ -210,6 +222,11 @@ SecureSignalsRegistry signalsRegistry(EndpointInvoker endpointInvoker) {
return new SecureSignalsRegistry(endpointInvoker);
}

void initSignalsObjectMapper(
@Observes StartupEvent event, @Named("endpointObjectMapper") ObjectMapper objectMapper) {
Signal.setMapper(objectMapper);
}

@Produces
@Singleton
@DefaultBean
Expand Down

0 comments on commit 4fb69e4

Please sign in to comment.