小编Mut*_*h k的帖子

Spring 启动应用程序未启动嵌入式 tomcat

我是 Spring 启动应用程序的新手。我有一个任务来创建应该由休息控制器处理的公共 crud 存储库。我只是从一些例子开始。但是我的应用程序并没有启动嵌入式tomcat。我的休息控制器 URI 也没有映射。这是 maven 模块项目,所有依赖项都在父 maven 中配置。如何解决这个问题。

这是我的代码

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
 public class CRUDEngineApplication {

 public static void main(String[] args) {
     SpringApplication.run(CRUDEngineApplication.class, args);
 }
}
Run Code Online (Sandbox Code Playgroud)

控制器是

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import com.scm.services.CRUDEngineService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@RestController("/api")
public class CRUDEngineController {
@Autowired
private CRUDEngineService crudEngineService;

public static final Logger logger = 
LoggerFactory.getLogger(CRUDEngineController.class);


/* public void setProductService(CRUDEngineService crudEngineService) {
    this.crudEngineService = crudEngineService;
}*/
@RequestMapping(value = …
Run Code Online (Sandbox Code Playgroud)

java maven spring-boot embedded-tomcat-8

2
推荐指数
1
解决办法
3万
查看次数

标签 统计

embedded-tomcat-8 ×1

java ×1

maven ×1

spring-boot ×1