我的spring boot应用程序无法正常工作。目前只暴露了一个端点。它只有一个控制器来管理它。下面是代码。
它构建良好,tomcat服务器运行正常,我得到
白标错误页
.
chrome控制台出现完全错误:
加载资源失败:服务器响应状态为404。
src
--|main
----|java
------|com.domain.myproject.api
--------|Controller <----(this is a package in intellij)
----------|RestController.java
--------|Springboot <----(this is a package in intellij)
----------|SpringApplication.java
RESTController。Java语言
package com.example.myproject.api.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class RESTController {
@GetMapping("/view/{id}")
public String hello (@PathVariable("id") String id){
return "return" + id;
}
}
SpringApplication。Java语言
package com.example.myproject.api.Springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CustomsApiApplication {
public static void main(String[] args) {
SpringApplication.run(CustomsApiApplication.class, args);
}
}
pom xml
这些是依赖项,我将使用它们。
<dependencies>
<!--SpringBoot Dependencies-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Camel dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.20.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jms</artifactId>
<version>2.20.1</version>
</dependency>
<!-- ActiveMQ dependencies -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
</dependency>
</dependencies>
谢谢
另请进入intellij run控制台。
2018-01-23 18:28:14.879 ERROR 10541 --- [nio-8080-exec-1]
o.s.d.r.w.RepositoryRestExceptionHandler : Could not resolve repository
metadata for 1234.