How To Launch Index Html Using SpringBoot


Index Html In Spring Boot Is Failing To Launch .

Solution : Change your Application.java class by extending SpringBootServletInitializer that will load the index.html at any folder inside resources lets say resources/htmlFiles/index.html

package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;

@SpringBootApplication
class Application extends SpringBootServletInitializer{
 
 @Override
 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  return application.sources(Application.class);

 }
  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
 }
}



0 comments:

Post a Comment