JSON and MultipartFile in POST Controller

I have a controller method, which accepts a multipart post request, containing json and a binary file. It does it's job, but I would like to get rid of explicit objectMapper.readValue() call. @PostMapping public void createEmployee(@RequestParam("em...
more »

2017-10-13 08:10 (1) Answers

Spring Boot Convention for Variables

So I have an application.yml file for my spring boot application like so: spring: url: localhost email: from: something@gmail.com app: uuid: 3848348j34jk2dne9 I want to wire these configuration properties into different components in my app ...
more »

2017-08-31 01:08 (1) Answers

Dynamic serialization/deserialization

I use Spring MVC and Jackson to drive the API of a application that I work in. I am faced with the following situation, we need serialize the Person class below in two different ways... @Entity Order{ String id; String name; String add...
more »

2017-08-29 16:08 (2) Answers

Using Spring variable in javascript

I'm trying to use a Spring variable in javascript: Map<String, List<String>> states; and I found some information here so I tried: <script th:inline="javascript"> /*<![CDATA[*/ var xxx = ${states}; console.log(xxx...
more »

2017-08-29 10:08 (2) Answers

What is taking long on Jetty startup?

Starting Jetty there's a long delay (8s) before my web application starts loading 13:50:10 [INFO] jetty-9.4.5.v20170502 13:50:18 [INFO] Scanning elapsed time=146ms With debug logging turned on there are two interesting steps Extracting dependent...
more »

2017-08-09 14:08 (1) Answers

Restrict JSON attributes for @RequestBody

This may be a simple task, but I couldn't find a way to do it. Basically, I need to disallow some parameters at the time of using @RequestBody annotation in my controller. Here is my model: @Data public class MyModel { private int id; private S...
more »

2017-08-09 10:08 (1) Answers

Best way to send file from java server to client

I uploaded an image successfully in MYSQL database using spring MVC(MultipartFile) and hibernate. now I want to get it from db and set it in my page with ajax request and my request is done successfully .(server response is ok) but the server(java) ...
more »

2017-08-03 16:08 (1) Answers

JsonMappingException when parsing json to Object

I want to change json to object by jackson, and the object contains Date type field. Exception: com.fasterxml.jackson.databind.JsonMappingException: Failed to parse Date value '30-Mar-2017' (format: "dd-MMM-yyyy"): Unparseable date: "30-Mar-2017...
more »

2017-08-02 11:08 (1) Answers