code: public void init(ObjectMapper objectMapper) {
          if (resultFactory == null) {
              resultFactory = new ImmediateResultFactory();
          }
          PreconditionUtil.verifyEquals(InitializedState.NOT_INITIALIZED, initializedState, "already initialized");
          this.initializedState = InitializedState.INITIALIZING;
          this.objectMapper = objectMapper;
          this.objectMapper.registerModules(getJacksonModules());
          typeParser.setObjectMapper(objectMapper);
  
          initializeModules();
  
          if (isServer) {
              applyRepositoryRegistrations();
              applyResourceRegistrations();
          }
  
          ExceptionMapperLookup exceptionMapperLookup = getExceptionMapperLookup();
          ExceptionMapperRegistryBuilder mapperRegistryBuilder = new ExceptionMapperRegistryBuilder();
          exceptionMapperRegistry = mapperRegistryBuilder.build(exceptionMapperLookup);
  
          filterBehaviorProvider =
                  new ResourceFilterDirectoryImpl(aggregatedModule.getResourceFilters(), httpRequestContextProvider,
                          resourceRegistry);
          this.initializedState = InitializedState.INITIALIZED;
      }
docs: Initializes the {@link ModuleRegistry} and applies all pending changes.
  After the initialization completed, it is not possible to add any further
  modules.
  
  @param objectMapper object mapper