BAEL-4687: formatted code with eclipse formatter
This commit is contained in:
parent
c19b868d3b
commit
65e9e80f0c
|
@ -1,9 +1,9 @@
|
|||
package com.baeldung.boot.jackson.config;
|
||||
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
|
||||
public class CoffeeConstants {
|
||||
|
||||
public static final String dateTimeFormat = "dd-MM-yyyy HH:mm";
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.baeldung.boot.jackson.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
@Configuration
|
||||
public class CoffeeCustomizerConfig {
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package com.baeldung.boot.jackson.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
@Configuration
|
||||
public class CoffeeHttpConverterConfiguration {
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package com.baeldung.boot.jackson.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
@Configuration
|
||||
public class CoffeeJacksonBuilderConfig {
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package com.baeldung.boot.jackson.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
|
||||
@Configuration
|
||||
public class CoffeeObjectMapperConfig {
|
||||
|
@ -17,8 +18,7 @@ public class CoffeeObjectMapperConfig {
|
|||
public ObjectMapper objectMapper() {
|
||||
JavaTimeModule module = new JavaTimeModule();
|
||||
module.addSerializer(localDateTimeSerializer);
|
||||
return new ObjectMapper()
|
||||
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
|
||||
.registerModule(module);
|
||||
return new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL)
|
||||
.registerModule(module);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package com.baeldung.boot.jackson.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
import static com.baeldung.boot.jackson.config.CoffeeConstants.localDateTimeSerializer;
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:coffee.properties")
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
package com.baeldung.boot.jackson.controller;
|
||||
|
||||
import com.baeldung.boot.jackson.model.Coffee;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baeldung.boot.jackson.model.Coffee;
|
||||
|
||||
@RestController
|
||||
public class CoffeeController {
|
||||
|
||||
@GetMapping("/coffee")
|
||||
public Coffee getCoffee(@RequestParam(required = false) String brand,
|
||||
@RequestParam(required = false) String name) {
|
||||
return new Coffee()
|
||||
.setBrand(brand)
|
||||
.setDate(LocalDateTime.now())
|
||||
.setName(name);
|
||||
public Coffee getCoffee(@RequestParam(required = false) String brand, @RequestParam(required = false) String name) {
|
||||
return new Coffee().setBrand(brand)
|
||||
.setDate(LocalDateTime.now())
|
||||
.setName(name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue