GeezerVison is showing github.com — Spring Boot以及Feign使用Java 8中LocalDate等时间日期类的问题解决 · codeyoyo/SpringBoot-Learning@abc8dfd
File tree
Expand file treeCollapse file tree
Open diff view settings
Chapter3-1-7/src/main/java/com/didispace
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Chapter3-1-7/src/main/java/com/didispace/Application.java +15-1Lines changed: 15 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | package com.didispace; |
2 | 2 |
|
3 | | -import com.didispace.dto.UserDto; |
4 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; |
5 | 4 | import com.fasterxml.jackson.databind.SerializationFeature; |
6 | 5 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| 6 | +import lombok.AllArgsConstructor; |
| 7 | +import lombok.Data; |
| 8 | +import lombok.NoArgsConstructor; |
7 | 9 | import org.springframework.boot.SpringApplication; |
8 | 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
9 | 11 | import org.springframework.context.annotation.Bean; |
10 | 12 | import org.springframework.web.bind.annotation.PostMapping; |
11 | 13 | import org.springframework.web.bind.annotation.RequestBody; |
12 | 14 | import org.springframework.web.bind.annotation.RestController; |
13 | 15 |
|
| 16 | +import java.time.LocalDate; |
| 17 | + |
14 | 18 | /** |
15 | 19 | * @author 程序猿DD |
16 | 20 | * @version 1.0.0 |
@@ -33,6 +37,16 @@ public UserDto user(@RequestBody UserDto userDto) throws Exception { |
33 | 37 |
|
34 | 38 | } |
35 | 39 |
|
| 40 | + @Data |
| 41 | + @NoArgsConstructor |
| 42 | + @AllArgsConstructor |
| 43 | + static class UserDto { |
| 44 | + |
| 45 | + private String userName; |
| 46 | + private LocalDate birthday; |
| 47 | + |
| 48 | + } |
| 49 | + |
36 | 50 | @Bean |
37 | 51 | public ObjectMapper serializingObjectMapper() { |
38 | 52 | ObjectMapper objectMapper = new ObjectMapper(); |
|
Collapse file
Copy file name to clipboardExpand all lines: Chapter3-1-7/src/main/java/com/didispace/dto/UserDto.java -17Lines changed: 0 additions & 17 deletions