'Java web application when hosted on server, cant find resources under [/] "The requested resource [/] is not available"

I made spring boot web app that works perfectly when I run it in Localhost, but when I exported it from IntelliJ to .war ( via Maven/package ) and upload it to cPanel under home/webapps and name it ROOT I get 404 on my website and it says that The requested resource [/] is not available.

enter image description here

@SpringBootApplication
@RestController
public class StajicApplication extends SpringBootServletInitializer {


@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    return builder.sources(StajicApplication.class);
}

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

/

@Controller
public class WebiteController {


@GetMapping(value = {"/", "/index"})
public String showHomePage(){
    return "/website/index";
}

@GetMapping(value="/resume")
public String showResumePage(){
    return "/website/resume";
}

@GetMapping(value="/projects")
public String showProjectsPage(){
    return "/website/projects";
}}

I figured it out that the problem is obviously that content cant be find ( index.html, resume.html ... ) So I uploaded index.html into root folder and bada bing bada boom it woorks, but only that index page nothing else /resume doesnt work for some reason,and no css is showed.

So obviously I have to map where is the content, even though Its placed as it should be under src/main/resources/templates/website/index.html

So main question is How do I tell cPanel or my spring boot application when I export it .WAR , hey html and css is here?

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source