Cannot convert java.util.Optional with stream

后端 未结 3 1282
-上瘾入骨i
-上瘾入骨i 2021-01-26 11:51

I\'m trying to use stream in java, i had a student class:

@Entity
@Data @AllArgsConstructor @NoArgsConstructor
public class Student {
    @Id @GeneratedValue(str         


        
3条回答
  •  借酒劲吻你
    2021-01-26 12:10

    To be able to use it in map() function, StudentRepository.findById() needs to return Optional instead of just Student.

提交回复
热议问题