0

I am using Eclipse Neon, (4.6) with the Spring IDE plugin (3.8.1) for developing a Spring Boot App. Using the Spring Boot Dashboard and the Spring Boot Configuration for managing running the App within Eclipse. Everything has been working fine when running the Application through the Spring Boot Dashboard.

I have now added an external property file to the application and reference it in my @Configuration class using @PropertySource(value = {"classpath:fee.properties" }). I have also added an 'external folder' location on the classpath through the spring boot configuration. Open the configuration, go to the classpath tab, press 'Advanced', then 'Add External Folder', adding the folder location of the property file.

When starting the application through the Spring Boot Dashboard per before, it reports a ClassNotFoundException on org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter

If I remove the external folder from the classpath tab in the configuration the App starts up fine until it hits the error because it cannot find the external property file.

If I run the application as a 'Java Application', right mouse click on the 'main' class of the Spring Boot app, 'Run As...Java Application', with the external folder it starts up fine.

So at the start of the main program before any Spring activity occurs I added the following to view the classpath

ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader)cl).getURLs();
for(URL url: urls){
    System.out.println(url.getFile());
}

When running from the Spring Boot dashboard several jars are missing from the classpath, when running either as a Java App, or without the external folder entry all the jars are present on the classpath.

Example of some of the missing jars are...

/Users/orlok/.m2/repository/org/springframework/spring-context-support/4.2.3.RELEASE/spring-context-support-4.2.3.RELEASE.jar
/Users/orlok/.m2/repository/org/springframework/boot/spring-boot/1.3.3.RELEASE/spring-boot-1.3.3.RELEASE.jar
/Users/orlok/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.3.3.RELEASE/spring-boot-starter-web-1.3.3.RELEASE.jar
/Users/orlok/.m2/repository/org/springframework/boot/spring-boot-starter/1.3.3.RELEASE/spring-boot-starter-1.3.3.RELEASE.jar
/Users/orlok/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.3.RELEASE/spring-boot-starter-logging-1.3.3.RELEASE.jar

I have attached 'Spring_Boot_classpath.txt' as the output that fails with the ClassNotFoundException, and 'Java_app_classpath.txt' as the output that works running as Java App, and has all the jars present.

What am I doing wrong, should the external folder be defined in a different way, or is this a problem with the plugin?

Orlok
  • 107
  • 6
  • Sounds like a problem with the plugin. There have been similar problems (https://issuetracker.springsource.com/browse/STS-4209 for example), but they should all be fixed. I'd recommend spend a new STS issue. – Andy Wilkinson Aug 10 '16 at 20:57
  • Opened issue [STS-4393](https://issuetracker.springsource.com/browse/STS-4393) – Orlok Aug 11 '16 at 12:35

0 Answers0