title: Inject JSON file into map
body: <p>I'm building a single page web app with a Spring Boot back-end and ideally want to share a JSON file that is used by the front-end as a routing enum of sorts and by the back-end to support mapping of certain routes back to <code>/index.html</code></p>
  
  <p>Here's the JSON file:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "Login": "/login",
    "ForgotPassword": "/forgot-password",
    "ResetPassword": "/reset-password",
    "Profile": "/profile",
    "Configuration": "/configuration",
    "Administration": "/admin"
  }
  </code></pre>
  
  <p>So far I've been doing this in Node.js as follows:</p>
  
  <pre class="lang-js prettyprint-override"><code>for (var pathname in Path) {
      if (Path.hasOwnProperty(pathname)) {
          app.get(Path[pathname], sendIndex);
      }
  }
  </code></pre>
  
  <p>Currently I have this:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class SpringConfigurations extends WebMvcConfigurerAdapter {
      @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/**")
                  .addResourceLocations("classpath:/static/");
      }
  }
  </code></pre>
  
  <p>Would there be a way of injecting the JSON file into, let's say, a <code>java.util.Map&lt;String,String&gt;</code> and then doing the following:</p>
  
  <pre><code>@Configuration
  public class SpringConfigurations extends WebMvcConfigurerAdapter {
      @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          pathsMap.values().forEach(path -&gt; {
              registry.addResourceHandler(path)
                      .addResourceLocations("classpath:/static/index.html");
          });
          registry.addResourceHandler("/**")
                  .addResourceLocations("classpath:/static/");
      }
  }
  </code></pre>