1 package org.onap.svnfm.simulator.config;
3 import java.net.InetAddress;
4 import java.util.Arrays;
5 import org.onap.svnfm.simulator.constants.Constant;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.boot.ApplicationArguments;
8 import org.springframework.boot.ApplicationRunner;
9 import org.springframework.cache.Cache;
10 import org.springframework.cache.CacheManager;
11 import org.springframework.cache.concurrent.ConcurrentMapCache;
12 import org.springframework.cache.support.SimpleCacheManager;
13 import org.springframework.context.annotation.Bean;
14 import org.springframework.core.env.Environment;
15 import org.springframework.stereotype.Component;
18 public class ApplicationConfig implements ApplicationRunner {
20 private static final String PORT = "local.server.port";
23 private Environment environment;
25 private String baseUrl;
28 public void run(final ApplicationArguments args) throws Exception {
29 baseUrl = "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty(PORT);
32 public String getBaseUrl() {
37 public CacheManager cacheManager() {
38 Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE);
39 SimpleCacheManager manager = new SimpleCacheManager();
40 manager.setCaches(Arrays.asList(inlineResponse201));