Deploying springboot war to tomcat throws 404

Viewed 20

I am able to run this as spring boot war that uses embeded tc.

In another thread it said use tomcat 9. I am using 10. Still getting the error.

My Spring boot App class:

package pra.learn.tcjardemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class TcjardemoApplication extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(TcjardemoApplication.class);
    }
    @GetMapping("/show")
    public static String getShow(){
        return "Show is the problem";
    }


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


}

Not sure what am i missing.

1 Answers

So, I deployed it on tc9 and it worked. Why isn't the same war working on tc10?

Related