Skip to content

Commit

Permalink
Spring Boot以及Feign使用Java 8中LocalDate等时间日期类的问题解决
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc87112 committed Mar 14, 2018
1 parent a2d33c0 commit abc8dfd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
16 changes: 15 additions & 1 deletion Chapter3-1-7/src/main/java/com/didispace/Application.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package com.didispace;

import com.didispace.dto.UserDto;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
* @author 程序猿DD
* @version 1.0.0
Expand All @@ -33,6 +37,16 @@ public UserDto user(@RequestBody UserDto userDto) throws Exception {

}

@Data
@NoArgsConstructor
@AllArgsConstructor
static class UserDto {

private String userName;
private LocalDate birthday;

}

@Bean
public ObjectMapper serializingObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
Expand Down
17 changes: 0 additions & 17 deletions Chapter3-1-7/src/main/java/com/didispace/dto/UserDto.java

This file was deleted.

0 comments on commit abc8dfd

Please sign in to comment.