Handling Static Resources in Spring MVC with Multiple Strategies
In Spring MVC, when the DispatcherServlet is mapped to /, it intercepts all incoming requests, including those for static assets like JavaScript, CSS, and images. Since no default handler mappings exist for static resources, such requests often result in 404 errors unless explicitly configured.
Registering a Resource Handler via Bean Definition ...
Posted on Sat, 26 Sep 2026 16:42:13 +0000 by rooky
Spring Boot Static Resource Configuration and Deployment Packaging
Static Resource Configuration
Configure static resource locations in application.yml:
spring:
resources:
static-locations: classpath:/static/
WAR Package Deployment
To package as WAR file, update pom.xml packaging type:
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<group ...
Posted on Sun, 10 May 2026 16:32:22 +0000 by Noctule
Serving Locally Stored Images in Spring Boot Applications
Approach 1: Programmatic File Streaming via Controller
When image are stored outside the web root or require access control, streaming the file through a dedicated endpoint is the standard approach. The frontend requests the image via a query parameter, and the backend reads the file from disk and pipes it directly to the HTTP response.
Fronten ...
Posted on Thu, 07 May 2026 22:53:37 +0000 by june_c21