spring.resources.static-locations not working with devtools

I have a project with the following structure (just like spring.io):

├── frontend
│   ├── dist
│   |   ├── app.js
│   |   ├── vendor.js
│   |   ├── style.css
│   |   ├── index.html
│   ├── node_modules
│   ├── src
│   ├── package.json
│   ├── pom.xml
├── site
│   ├── src
│   ├── pom.xml

frontend is a NodeJS project and site is a Spring Boot project.

All files inside frontend/dist (including html) are autogenerated by webpack. In order to access them from Spring Boot app I've configured development profile.


  profiles: development
      - file:../frontend/dist/

All works just fine. But when I add spring-boot-devtools into the site project classpath I get 404 for any file inside dist folder.

http://localhost:8080/ -> 404
http://localhost:8080/app.js -> 404

Again, no devtools - no problem.

Also if I replace static-locations with addResourceHandlers it works too (no matter with or without devtools).

public void addResourceHandlers(ResourceHandlerRegistry registry) {

Is this a devtools bug or my fault?


Ok thanks to @AndyWilkinson I've figured out the cause of the problem. I work in IntelliJ and use run configurations to set env variables. Here is the resulting command line:

/usr/lib/jvm/java-8-oracle/bin/java -bla-bla-bla -Didea.version=2017.1.3 -T 2 -Dspring.profiles.active=dev spring-boot:run

But if devtools is in the project classpath Spring Boot ignores them:

Could not find key 'spring.profiles.active' in any property source
No active profile set, falling back to default profiles: default

Now if I simply remove devtools from pom.xml

The following profiles are active: dev
Activated profiles dev

... wow, it works again.

The possible workaround is to set active profile directly through application.yml.

    active: dev


  profiles: dev
      - file:../frontend/dist/

.. but i don't like it because it's inconvenient.

So because devtools is such a pain I think I'll prefer to use F5 as before.