/** Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711 mappings.add("html", "text/html;charset=utf-8"); // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 mappings.add("json", "text/html;charset=utf-8"); container.setMimeMappings(mappings); // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets. setLocationForStaticAssets(container); }
private void setLocationForStaticAssets(ConfigurableEmbeddedServletContainer container) { File root; String prefixPath = resolvePathPrefix(); if (env.acceptsProfiles(Constants.SPRING_PROFILE_PRODUCTION)) { root = new File(prefixPath + "target/www/"); } else { root = new File(prefixPath + "src/main/webapp/"); } if (root.exists() && root.isDirectory()) { container.setDocumentRoot(root); } }
@Override public void customize(ConfigurableEmbeddedServletContainer container) { container.setPort(9000); }