I have to provide static .js files through a JAR project. For this I created a JAR(using MAVEN) which looks like:
parent
|--com
|--META-INF
|--webapp
|--resources
|--js
|--myjs.js
Now, I added this JAR to my parent spring-boot project and in one of the JSP
s added
<script src="resources/js/myjs.js"></script>
This gives me a 404 error.
My conclusion: Either the boot project does not merge webapp
folders from JARs into its own webapp
or I am accessing the file incorrectly.
These questions did not help(cannot change WebMvcConfigurerAdapter
and java code is strictly not allowed ):
SpringBoot - accessing a file inside resources folder
Serve static resources within jar files by Spring boot
Usually, such things are handled using overlays but that would be and overkill for a simple use case.