1818
1919import  org .springframework .http .converter .FormHttpMessageConverter ;
2020import  org .springframework .http .converter .cbor .KotlinSerializationCborHttpMessageConverter ;
21+ import  org .springframework .http .converter .cbor .MappingJackson2CborHttpMessageConverter ;
2122import  org .springframework .http .converter .json .GsonHttpMessageConverter ;
2223import  org .springframework .http .converter .json .JsonbHttpMessageConverter ;
2324import  org .springframework .http .converter .json .KotlinSerializationJsonHttpMessageConverter ;
3132
3233/** 
3334 * Extension of {@link org.springframework.http.converter.FormHttpMessageConverter}, 
34-  * adding support for XML and JSON-based parts. 
35+  * adding support for XML, JSON, Smile, CBOR, Protobuf and Yaml based parts when 
36+  * related libraries are present in the classpath. 
3537 * 
3638 * @author Rossen Stoyanchev 
3739 * @author Juergen Hoeller 
@@ -48,6 +50,8 @@ public class AllEncompassingFormHttpMessageConverter extends FormHttpMessageConv
4850
4951	private  static  final  boolean  jackson2SmilePresent ;
5052
53+ 	private  static  final  boolean  jackson2CborPresent ;
54+ 
5155	private  static  final  boolean  jackson2YamlPresent ;
5256
5357	private  static  final  boolean  gsonPresent ;
@@ -67,6 +71,7 @@ public class AllEncompassingFormHttpMessageConverter extends FormHttpMessageConv
6771						ClassUtils .isPresent ("com.fasterxml.jackson.core.JsonGenerator" , classLoader );
6872		jackson2XmlPresent  = ClassUtils .isPresent ("com.fasterxml.jackson.dataformat.xml.XmlMapper" , classLoader );
6973		jackson2SmilePresent  = ClassUtils .isPresent ("com.fasterxml.jackson.dataformat.smile.SmileFactory" , classLoader );
74+ 		jackson2CborPresent  = ClassUtils .isPresent ("com.fasterxml.jackson.dataformat.cbor.CBORFactory" , classLoader );
7075		jackson2YamlPresent  = ClassUtils .isPresent ("com.fasterxml.jackson.dataformat.yaml.YAMLFactory" , classLoader );
7176		gsonPresent  = ClassUtils .isPresent ("com.google.gson.Gson" , classLoader );
7277		jsonbPresent  = ClassUtils .isPresent ("jakarta.json.bind.Jsonb" , classLoader );
@@ -103,6 +108,10 @@ else if (jsonbPresent) {
103108			addPartConverter (new  MappingJackson2SmileHttpMessageConverter ());
104109		}
105110
111+ 		if  (jackson2CborPresent ) {
112+ 			addPartConverter (new  MappingJackson2CborHttpMessageConverter ());
113+ 		}
114+ 
106115		if  (jackson2YamlPresent ) {
107116			addPartConverter (new  MappingJackson2YamlHttpMessageConverter ());
108117		}
0 commit comments