Java tutorial
package gr.cti.android.experimentation; /*- * #%L * Smartphone Experimentation Web Service * $Id:$ * $HeadURL:$ * %% * Copyright (C) 2015 - 2016 CTI - Computer Technology Institute and Press "Diophantus" * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import java.util.List; @Configuration public class MessageConverter extends WebMvcConfigurerAdapter { @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { // http HttpMessageConverter converter = new StringHttpMessageConverter(); converters.add(converter); // string converter = new FormHttpMessageConverter(); converters.add(converter); // json converter = new MappingJackson2HttpMessageConverter(); converters.add(converter); } }