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> {
}