Skip to content

Tag: converters

HttpMessageConverter for Single Object and List of Object

I have an Object (here: Property) and I want to add csv export ability to my Spring Backend for single and list of objects. I added this to my config: and the Property Converter looks like this: This code works for a Single Property. When I try to return a list of Properties: I tried to add a PropertyListConverter but

Convert seconds into T1H15M5S (ISO_8601)

I would like to convert a number of seconds into ISO_8601/Duration in Java. Are there any existing methods to do it that are already built in? Answer Since ISO 8601 allows for the individual fields in a duration string to overflow, you could just prepend “PT” to the number of seconds and append “S”: This will output “PT4711S”, which