简体   繁体   English

在一个项目/应用程序Java中同时运行Springboot和Rest端点

[英]Running both Springboot and Rest endpoints in one project/application Java

I'm getting very confused over whether you can or can't run spring boot stuff and REST endpoints in one application. 我对是否可以在一个应用程序中运行spring boot东西和REST端点感到非常困惑。 At the moment I have them in separate project directories, running the springboot UI one with: 目前,我将它们放在单独的项目目录中,使用以下命令运行springboot UI:

@SpringBootApplication
public class LeagueProjectUiApplication {

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

and the REST rest endpoints with: REST其余端点具有:

mvn tomcat7:run

and my jersey and tomcat stuff are declared in my pom.xml 我的球衣和tomcat东西在pom.xml中声明

Rest: 休息:

@Path("/university")
public class University {

@GET
@Path("/{universitycode}")
@Produces(MediaType.APPLICATION_JSON)
public Response returnSingleSummoner(
        @PathParam("universitycode") String universityCode) {

}

What's the best way of running both SpringBoot and REST endpoints at the same time, or am I getting completely confused! 同时运行SpringBoot和REST端点的最佳方法是什么,否则我会完全困惑!

Thanks. 谢谢。

When you say REST endpoints, do you mean Jersey endpoints? 当您说REST端点时,您是指Jersey端点吗?

Spring Boot supports Jersey,as you can see, for example, here, so nothing theoretically should stop you for putting everything in one application as long as request paths are different. 如您在此处看到的, Spring Boot支持Jersey,因此从理论上讲,只要请求路径不同什么都不会阻止您将所有内容放入一个应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM