findAll()查詢不出結果
package com.example.demo;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Girl {
? ?@Id
? ?@GeneratedValue(strategy = GenerationType.IDENTITY)
? ?private Integer id;
? ?private String cupSize;
? ?private Integer age;
? ?public Girl() {
? ?}
? ?public Integer getId() {
? ? ? ?return id;
? ?}
? ?public void setId(Integer id) {
? ? ? ?this.id = id;
? ?}
? ?public String getCupSize() {
? ? ? ?return cupSize;
? ?}
? ?public void setCupSize(String cupSize) {
? ? ? ?this.cupSize = cupSize;
? ?}
? ?public Integer getAge() {
? ? ? ?return age;
? ?}
? ?public void setAge(Integer age) {
? ? ? ?this.age = age;
? ?}
}
package com.example.demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class GirlController {
? ?@Autowired
? ?private GirlRepository girlRepository;
? ?@GetMapping(value = "/girls")
? ?public List<Girl> girlList(){
? ? ? ?return girlRepository.findAll();
? ?}
}
package com.example.demo;
import org.springframework.data.jpa.repository.JpaRepository;
public interface GirlRepository extends JpaRepository<Girl,Integer> {
}
2018-03-07
MySQL 是否啟動正常??
錯誤提示是什么?
application.yml 或者 .propertity? 提供一下