I have a simple RestController application -
@RestController
public class GreetingController {
private static final Logger logger = LogManager.getLogger(GreetingController.class);
@RequestMapping("/greeting")
public ResponseEntity<GreetingResponse> greeting(@RequestParam(value = "name", defaultValue = "World") String name) throws ServiceException, Exception {
logger.info("Received Request. Name: " + name);
It works fine on SpringBoot (http://localhost:8080/greeting), but when I create a WAR and deploy it on Tomcat (9.0.2), it throws a 404.
Application is deployed fine and I can hit a static HTML page in the application, so my context path is correct.
What could I be missing?
Here is my gradle tasks -
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('com.jayway.jsonpath:json-path')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.10.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.10.0'
}
war {
archiveName = "ROOT.war"
manifest {attributes "Implementation-Version": "${version}"}
}
I have zip of my whole application here, if anyone is curious.