brikar-server/src/main/java/com/truward/brikar/server/context/StandardWebApplicationContextInitializer.java
@Nonnull
  public static AutoCloseable register(@Nonnull ServletInitializer servletInitializer,
                                       @Nonnull PropertySource<?> source) {
    final BigInteger bigInteger = new BigInteger(64, ThreadLocalRandom.current());
    final String key = bigInteger.toString(16);

    if (PROPERTIES.containsKey(key)) {
      return register(servletInitializer, source); // shouldn't happen
    }

    // associate this key with the context parameter
    servletInitializer.setInitParameter(PROPERTY_SOURCE_SERVLET_CONFIG_KEY, key);
    // ... and put it to the globally visible properties map
    PROPERTIES.put(key, source);

    return new AutoCloseable() {
      @Override
      public void close() {
        PROPERTIES.remove(key);
      }
    };
  }
@Nonnull
  public static AutoCloseable register(@Nonnull ServletInitializer servletInitializer,
                                       @Nonnull PropertySource<?> source) {
    final BigInteger bigInteger = new BigInteger(64, ThreadLocalRandom.current());
    final String key = bigInteger.toString(16);

    if (PROPERTIES.containsKey(key)) {
      return register(servletInitializer, source); // shouldn't happen
    }

    // associate this key with the context parameter
    servletInitializer.setInitParameter(PROPERTY_SOURCE_SERVLET_CONFIG_KEY, key);
    // ... and put it to the globally visible properties map
    PROPERTIES.put(key, source);

    return new AutoCloseable() {
      @Override
      public void close() {
        PROPERTIES.remove(key);
      }
    };
  }
@ Nonnull public static AutoCloseable register ( @ Nonnull ServletInitializer servletInitializer , @ Nonnull PropertySource < ? > source ) { final BigInteger bigInteger = new BigInteger ( 64 , ThreadLocalRandom . current ( ) ) ; final String key = bigInteger . toString ( 16 ) ; if ( PROPERTIES . containsKey ( key ) ) { return register ( servletInitializer , source ) ; // shouldn't happen } // associate this key with the context parameter servletInitializer . setInitParameter ( PROPERTY_SOURCE_SERVLET_CONFIG_KEY , key ) ; // ... and put it to the globally visible properties map PROPERTIES . put ( key , source ) ; return new AutoCloseable ( ) { @ Override public void close ( ) { PROPERTIES . remove ( key ) ; } } ; }
Encapsulates the logic for associating property source with a given servlet.

@param servletInitializer A callback that encapsulates the call to the container specific way to set init parameter
@param source Property source, that needs to be registered and later available to the spring context
@return A closeable instance that should be closed to perform cleanup once server is stopped
Encapsulates the logic for associating property source with a given servlet .