I wrote a small project using SpringBoot with several RESTful services to learn the framework and REST technology. When run through spring-boot: run, everything works correctly, is available at http: // localhost: 8080 / and then follow the links specified via @RequestMapping in the controller. For example, by http: // localhost: 8080 / restapp / test / {id}:
@RequestMapping(value = "http ://localhost:8080/restapps-0.0.1-SNAPSHOT/restapp/test/{id}", method = RequestMethod.GET) public String getWelcome(@PathVariable(value = "id") String id) { return "Welcome to jax-rs " + id; } When trying to deploy to full tomcat, the project runs on http: // localhost: 8080 / project_version and opens the default index.html file (which I learned by chance, because this file was transferred for initial testing), and then to services there is no access to all addresses:
http: // localhost: 8080 / project_version / restapp / test / {id}
http: // localhost: 8080 / project_version / test / {id}
http: // localhost: 8080 / project_version / project_name / restapp / test / {id}
gives 404.
Application.java
@Configuration @EnableAutoConfiguration @ComponentScan public class Application { public static void main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class, args); } } Controller.java
@RestController public class Controller extends ApplicationConfig { @Override public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(); s.add(Controller.class); return s; } @RequestMapping(value = "http ://localhost:8080/restapps-0.0.1-SNAPSHOT/restapp/test/{id}", method = RequestMethod.GET) public String getWelcome(@PathVariable(value = "id") String id) { return "Welcome to jax-rs " + id; } } ApplicationConfig is an empty class that extends Application.
Thanks for any tips / answers.