Solution next error.
Add next class:
package your_package;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class StaticResourceConfiguration implements WebMvcConfigurer {
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
"classpath:/META-INF/resources/",
"classpath:/resources/",
"classpath:/static/",
"classpath:/public/"
};
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
}
}
and try again access, for example:
http:localhost:8080/your_html.html
or
http:localhost:8080/your_context/your_html.html
References:
https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
Subscribe to:
Post Comments (Atom)
Integrating Google Cloud Pub/Sub with Terraform and Spring Boot 3 (Java 21)
Introduction In this blog post, I'll demonstrate how to provision Google Cloud Pub/Sub resources using Terraform and integrate them with...

-
SAML V2.0 SAML version 2.0 was approved as an OASIS Standard in March 2005. Approved Errata for SAML V2.0 was last produced by the SSTC on 1...
-
Spring Boot 3 Spring boot 3 Features : Spring Boot 3.0 will require Java 17 or later Jakarta EE 9 a new top-level jakarta package, replacin...
-
Introduction In today's software landscape, designing robust and scalable REST APIs is a crucial aspect of application development. Wit...
No comments:
Post a Comment