javascriptcssspring-bootthymeleafstatic-resource

Spring Boot 2: some static resources are not loaded


I added static resources into /static/ path in spring boot application.

/static/
   /css/
   /images/
   /js/

When page loaded some css and js files are not loaded. For example: /static/js/jquery-ui/css/no-theme/jquery-ui-1.10.3.custom.min.css loaded, but, /static/js/jquery-ui/js/jquery-ui-1.10.3.minimal.min.js and /static/css/font-icons/entypo/css/entypo.css resources are not loaded - returned 404. If I move these resources to 1 or 2 step upward in folder tree, theese resources get reachable, so I can download them with direct url. but I don't want to do this. Because they are part of some template and moving can damage theme structure.


Solution

  • I copied not loaded files to same folder with different name.

    /static/css/font-icons/entypo/css/
        entypo.css
        entypo_1.css
    

    After, deleted old version and renamed new copy as old version. I don't know why, but after doing this operation for all not loaded resources they are loaded. Now its work for me.

    EDITED

    It need to be cleaned and built project in such situations.

    This problem occurred again when I run project without building after checking out project to another PC from SVN. Then I cleaned and built project and run. The problem did not occur after that