小编Jul*_*ius的帖子

SpringBoot的RequestMapping方法未调用

我正在学习SpringBoot。使用Spring JavaPersistenceAPI(JPA)和apache derby作为数据库。我在将URL映射到方法时遇到麻烦

我有主题:

@Entity
public class Topic {

@Id
private String id;
private String name;
private String description;

public Topic() {

}

public Topic(String id, String name, String description) {
    this.id = id;
    this.name = name;
    this.description = description;
} ... getters & setters...
Run Code Online (Sandbox Code Playgroud)

我有一个主题控制器。它工作正常:

@RestController
    public class TopicController {

@Autowired
private TopicService topicServ;

@RequestMapping("/topics")
public List<Topic> getAllTopics() {
    return topicServ.getAllTopics();
} 
@RequestMapping("/topics/{topicId}")
public Topic getTopic(@PathVariable String topicId) {
    return topicServ.getTopic(topicId);
}... more methods (they work fine) …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot

2
推荐指数
2
解决办法
1250
查看次数

标签 统计

java ×1

spring ×1

spring-boot ×1