Skip to content

Commit abc8dfd

Browse files
committed
Spring Boot以及Feign使用Java 8中LocalDate等时间日期类的问题解决
1 parent a2d33c0 commit abc8dfd

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

Chapter3-1-7/src/main/java/com/didispace/Application.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
package com.didispace;
22

3-
import com.didispace.dto.UserDto;
43
import com.fasterxml.jackson.databind.ObjectMapper;
54
import com.fasterxml.jackson.databind.SerializationFeature;
65
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
6+
import lombok.AllArgsConstructor;
7+
import lombok.Data;
8+
import lombok.NoArgsConstructor;
79
import org.springframework.boot.SpringApplication;
810
import org.springframework.boot.autoconfigure.SpringBootApplication;
911
import org.springframework.context.annotation.Bean;
1012
import org.springframework.web.bind.annotation.PostMapping;
1113
import org.springframework.web.bind.annotation.RequestBody;
1214
import org.springframework.web.bind.annotation.RestController;
1315

16+
import java.time.LocalDate;
17+
1418
/**
1519
* @author 程序猿DD
1620
* @version 1.0.0
@@ -33,6 +37,16 @@ public UserDto user(@RequestBody UserDto userDto) throws Exception {
3337

3438
}
3539

40+
@Data
41+
@NoArgsConstructor
42+
@AllArgsConstructor
43+
static class UserDto {
44+
45+
private String userName;
46+
private LocalDate birthday;
47+
48+
}
49+
3650
@Bean
3751
public ObjectMapper serializingObjectMapper() {
3852
ObjectMapper objectMapper = new ObjectMapper();

Chapter3-1-7/src/main/java/com/didispace/dto/UserDto.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)