0

I have this problem in spring boot 1.5.1RELEASE In my properties i have got a property config-dir. Using resource handler I can add my config folder by:

public PortalAppConfig(@Value("${config-dir}") String configDir) {
   this.configDir = configDir;
 }

public void addResourceHandlers(final ResourceHandlerRegistry registry) {
   registry
       .addResourceHandler("/assets/config/**")
       .addResourceLocations(String.format("file:%s", configDir));
 }

When I declare config-dir as an external folder, like config-dir: ${user.home}/externalConfigFolder/ everything works fine. However I have no idea how to point path to that directory, so It could use directory from JAR file. I tried classpath:static/assets/config, static/assets/config and many other variations. Those pictures shows directory tree for both resources and target

I know that the question sound similar to Classpath resource not found when running as jar but in my case I do not want to 'use' a file inside a jar, but point to the whole directory (using path as a String) and add it to resourceHandler. I am building project using maven. Java 8.

enter image description here enter image description here

Thamiar
  • 600
  • 7
  • 22

0 Answers0