Intellij spring boot app does not work from tomcat

Viewed 9058

This is my class

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Configuration
@ComponentScan
@EnableAutoConfiguration
@SpringBootApplication
public class TomcatIcınApplication {

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

@RestController
class GreetingController {

    @RequestMapping("/hello/hi")
    String hello( ) {
        return "Hello, xx!";
    }
}

When i run application and open localhost:8080/hello/hi, i can see the output. But from Edit Configurations, when i add tomcat server on port 8081 as localhost:8081/hello and run tomcat this time, it invokes app and opens page but it is empty.

Why can't i see my output?

1 Answers
Related