message-transformation.html 146.0 KB
Newer Older
茶陵後's avatar
茶陵後 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601
<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Message Transformation | Spring Docs</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" type="image/png" sizes="16x16" href="/images/icons/favicon.ico">
    <link rel="icon" type="image/png" sizes="48x48" href="/images/icons/icon-48x48.png">
    <link rel="icon" type="image/png" sizes="72x72" href="/images/icons/icon-72x72.png">
    <link rel="manifest" href="/manifest.webmanifest">
    <link rel="apple-touch-icon" href="/images/icons/icon_48x48.png">
    <link rel="mask-icon" href="/images/icons/favicon.ico" color="#5dac38">
    <script>
    var _hmt = _hmt || [];
    (function () {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?8eefd6b163dcb3f5762af6b0825e2dd1";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
    <meta name="description" content="Message transformers play a very important role in enabling the loose-coupling of message producers and message consumers.
Rather than requiring every message-producing component to know what type is expected by the next consumer, you can add transformers between those components.
Generic transformers, such as one that converts a String to an XML Document, are also highly reusable.">
    <meta name="twitter:title" content="Message Transformation">
    <meta name="twitter:description" content="Message transformers play a very important role in enabling the loose-coupling of message producers and message consumers.
Rather than requiring every message-producing component to know what type is expected by the next consumer, you can add transformers between those components.
Generic transformers, such as one that converts a String to an XML Document, are also highly reusable.">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:url" content="https://spring.gitcode.net/en/spring-integration/message-transformation.html">
    <meta property="og:type" content="article">
    <meta property="og:title" content="Message Transformation">
    <meta property="og:description" content="Message transformers play a very important role in enabling the loose-coupling of message producers and message consumers.
Rather than requiring every message-producing component to know what type is expected by the next consumer, you can add transformers between those components.
Generic transformers, such as one that converts a String to an XML Document, are also highly reusable.">
    <meta property="og:url" content="https://spring.gitcode.net/en/spring-integration/message-transformation.html">
    <meta property="og:site_name" content="Spring 中文文档社区">
    <meta itemprop="name" content="Message Transformation">
    <meta itemprop="description" content="Message transformers play a very important role in enabling the loose-coupling of message producers and message consumers.
Rather than requiring every message-producing component to know what type is expected by the next consumer, you can add transformers between those components.
Generic transformers, such as one that converts a String to an XML Document, are also highly reusable.">
    <meta name="application-name" content="Spring 中文文档社区">
    <meta name="apple-mobile-web-app-title" content="Spring 中文社区">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileColor" content="#5dac38">
    <meta name="theme-color" content="#5dac38">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="baidu-site-verification" content="code-tApgxyb9G8">
    
    <link rel="preload" href="/assets/css/0.styles.af3770e9.css" as="style"><link rel="preload" href="/assets/js/app.cf11b18e.js" as="script"><link rel="preload" href="/assets/js/3.50918073.js" as="script"><link rel="preload" href="/assets/js/4.cd4c3ff4.js" as="script"><link rel="preload" href="/assets/js/128.456206df.js" as="script"><link rel="prefetch" href="/assets/js/10.675f4d7e.js"><link rel="prefetch" href="/assets/js/100.89ddf0f9.js"><link rel="prefetch" href="/assets/js/101.a2584c55.js"><link rel="prefetch" href="/assets/js/102.53225958.js"><link rel="prefetch" href="/assets/js/103.be06048d.js"><link rel="prefetch" href="/assets/js/104.a2328e06.js"><link rel="prefetch" href="/assets/js/105.78529341.js"><link rel="prefetch" href="/assets/js/106.fc779386.js"><link rel="prefetch" href="/assets/js/107.375c8dec.js"><link rel="prefetch" href="/assets/js/108.cf4ca7e2.js"><link rel="prefetch" href="/assets/js/109.f4d3964d.js"><link rel="prefetch" href="/assets/js/11.b58e279a.js"><link rel="prefetch" href="/assets/js/110.4ae56c4d.js"><link rel="prefetch" href="/assets/js/111.baf7121d.js"><link rel="prefetch" href="/assets/js/112.a963ade8.js"><link rel="prefetch" href="/assets/js/113.edbb458c.js"><link rel="prefetch" href="/assets/js/114.7e2b354f.js"><link rel="prefetch" href="/assets/js/115.4e41285c.js"><link rel="prefetch" href="/assets/js/116.1ee84ed6.js"><link rel="prefetch" href="/assets/js/117.4952cce2.js"><link rel="prefetch" href="/assets/js/118.306eabfa.js"><link rel="prefetch" href="/assets/js/119.5a4712e9.js"><link rel="prefetch" href="/assets/js/12.c41ab7bc.js"><link rel="prefetch" href="/assets/js/120.496c9660.js"><link rel="prefetch" href="/assets/js/121.e4a22135.js"><link rel="prefetch" href="/assets/js/122.02f82a94.js"><link rel="prefetch" href="/assets/js/123.53c5a24e.js"><link rel="prefetch" href="/assets/js/124.11d8be3e.js"><link rel="prefetch" href="/assets/js/125.c0740874.js"><link rel="prefetch" href="/assets/js/126.9cb2911c.js"><link rel="prefetch" href="/assets/js/127.6f87a638.js"><link rel="prefetch" href="/assets/js/129.ce51dc7d.js"><link rel="prefetch" href="/assets/js/13.1147a447.js"><link rel="prefetch" href="/assets/js/130.66718f4c.js"><link rel="prefetch" href="/assets/js/131.713226b7.js"><link rel="prefetch" href="/assets/js/132.6e2b68e3.js"><link rel="prefetch" href="/assets/js/133.11148e38.js"><link rel="prefetch" href="/assets/js/134.8de25763.js"><link rel="prefetch" href="/assets/js/135.961f6693.js"><link rel="prefetch" href="/assets/js/136.8abc4532.js"><link rel="prefetch" href="/assets/js/137.331bfb6b.js"><link rel="prefetch" href="/assets/js/138.f76ee7b9.js"><link rel="prefetch" href="/assets/js/139.578aa70e.js"><link rel="prefetch" href="/assets/js/14.1c437f54.js"><link rel="prefetch" href="/assets/js/140.9f1f28a0.js"><link rel="prefetch" href="/assets/js/141.b08ac1ec.js"><link rel="prefetch" href="/assets/js/142.e5c934cf.js"><link rel="prefetch" href="/assets/js/143.2a9d47c6.js"><link rel="prefetch" href="/assets/js/144.76090f65.js"><link rel="prefetch" href="/assets/js/145.41a54d41.js"><link rel="prefetch" href="/assets/js/146.979b34c1.js"><link rel="prefetch" href="/assets/js/147.46e366af.js"><link rel="prefetch" href="/assets/js/148.efcd2b17.js"><link rel="prefetch" href="/assets/js/149.04135c0b.js"><link rel="prefetch" href="/assets/js/15.cbd21f6a.js"><link rel="prefetch" href="/assets/js/150.679d76bf.js"><link rel="prefetch" href="/assets/js/151.2b0748da.js"><link rel="prefetch" href="/assets/js/152.cee5bbcd.js"><link rel="prefetch" href="/assets/js/153.680b4156.js"><link rel="prefetch" href="/assets/js/154.0c6972fe.js"><link rel="prefetch" href="/assets/js/155.35a3e5ab.js"><link rel="prefetch" href="/assets/js/156.6782d874.js"><link rel="prefetch" href="/assets/js/157.b9fe2583.js"><link rel="prefetch" href="/assets/js/158.96656194.js"><link rel="prefetch" href="/assets/js/159.2a0f7744.js"><link rel="prefetch" href="/assets/js/16.0cc4679e.js"><link rel="prefetch" href="/assets/js/160.c26bf909.js"><link rel="prefetch" href="/assets/js/161.45a3950a.js"><link rel="prefetch" href="/assets/js/162.4a08c069.js"><link rel="prefetch" href="/assets/js/163.a540d00c.js"><link rel="prefetch" href="/assets/js/164.117eb7b8.js"><link rel="prefetch" href="/assets/js/165.4fabe2ea.js"><link rel="prefetch" href="/assets/js/166.27d3bfe9.js"><link rel="prefetch" href="/assets/js/167.c8a74627.js"><link rel="prefetch" href="/assets/js/168.e16111b9.js"><link rel="prefetch" href="/assets/js/169.458ea1d8.js"><link rel="prefetch" href="/assets/js/17.d3f5977b.js"><link rel="prefetch" href="/assets/js/170.4b38adcf.js"><link rel="prefetch" href="/assets/js/171.98cb45b7.js"><link rel="prefetch" href="/assets/js/172.9ca2eb1a.js"><link rel="prefetch" href="/assets/js/173.14074c7f.js"><link rel="prefetch" href="/assets/js/174.8e1f9887.js"><link rel="prefetch" href="/assets/js/175.5989a4ca.js"><link rel="prefetch" href="/assets/js/176.89b35f24.js"><link rel="prefetch" href="/assets/js/177.8ca04666.js"><link rel="prefetch" href="/assets/js/178.f1f78ad5.js"><link rel="prefetch" href="/assets/js/179.a1faadfe.js"><link rel="prefetch" href="/assets/js/18.1a2bbade.js"><link rel="prefetch" href="/assets/js/180.33be0a0d.js"><link rel="prefetch" href="/assets/js/181.074198fc.js"><link rel="prefetch" href="/assets/js/182.2ea92f58.js"><link rel="prefetch" href="/assets/js/183.316f0529.js"><link rel="prefetch" href="/assets/js/184.f6dd5f36.js"><link rel="prefetch" href="/assets/js/185.134f1457.js"><link rel="prefetch" href="/assets/js/186.2aa74077.js"><link rel="prefetch" href="/assets/js/187.3a956aba.js"><link rel="prefetch" href="/assets/js/188.01a6573f.js"><link rel="prefetch" href="/assets/js/189.a8d65b4d.js"><link rel="prefetch" href="/assets/js/19.e062ea88.js"><link rel="prefetch" href="/assets/js/190.c753d8e3.js"><link rel="prefetch" href="/assets/js/191.280fe1e2.js"><link rel="prefetch" href="/assets/js/192.bbc94e32.js"><link rel="prefetch" href="/assets/js/193.41421d14.js"><link rel="prefetch" href="/assets/js/194.15f508e4.js"><link rel="prefetch" href="/assets/js/195.a17f3877.js"><link rel="prefetch" href="/assets/js/196.d17bfcdf.js"><link rel="prefetch" href="/assets/js/197.65791a5a.js"><link rel="prefetch" href="/assets/js/198.0441041e.js"><link rel="prefetch" href="/assets/js/199.538f2285.js"><link rel="prefetch" href="/assets/js/20.6c49f026.js"><link rel="prefetch" href="/assets/js/200.4ff8dbc4.js"><link rel="prefetch" href="/assets/js/201.088ccf86.js"><link rel="prefetch" href="/assets/js/202.8bdad311.js"><link rel="prefetch" href="/assets/js/203.45d3ecc5.js"><link rel="prefetch" href="/assets/js/204.c403aa39.js"><link rel="prefetch" href="/assets/js/205.e992b689.js"><link rel="prefetch" href="/assets/js/206.eed8bd42.js"><link rel="prefetch" href="/assets/js/207.3db1fc87.js"><link rel="prefetch" href="/assets/js/208.27399a7b.js"><link rel="prefetch" href="/assets/js/209.829f007c.js"><link rel="prefetch" href="/assets/js/21.0ed0e55b.js"><link rel="prefetch" href="/assets/js/210.35079683.js"><link rel="prefetch" href="/assets/js/211.94056191.js"><link rel="prefetch" href="/assets/js/212.431059ab.js"><link rel="prefetch" href="/assets/js/213.4d25e21f.js"><link rel="prefetch" href="/assets/js/214.e62f8fc5.js"><link rel="prefetch" href="/assets/js/215.433d7113.js"><link rel="prefetch" href="/assets/js/216.6de56c4d.js"><link rel="prefetch" href="/assets/js/217.ad3e1cd0.js"><link rel="prefetch" href="/assets/js/218.c225521d.js"><link rel="prefetch" href="/assets/js/219.f4241738.js"><link rel="prefetch" href="/assets/js/22.3563c6e0.js"><link rel="prefetch" href="/assets/js/220.ac9c6899.js"><link rel="prefetch" href="/assets/js/221.ff4ee0d2.js"><link rel="prefetch" href="/assets/js/222.20629300.js"><link rel="prefetch" href="/assets/js/223.a5fa0166.js"><link rel="prefetch" href="/assets/js/224.65290c4f.js"><link rel="prefetch" href="/assets/js/225.e698f717.js"><link rel="prefetch" href="/assets/js/226.4b28f10d.js"><link rel="prefetch" href="/assets/js/227.f44065ae.js"><link rel="prefetch" href="/assets/js/228.0b254d68.js"><link rel="prefetch" href="/assets/js/229.560ccb5c.js"><link rel="prefetch" href="/assets/js/23.2bc6a9e3.js"><link rel="prefetch" href="/assets/js/230.2e09449c.js"><link rel="prefetch" href="/assets/js/231.b09e3f00.js"><link rel="prefetch" href="/assets/js/232.eaa54385.js"><link rel="prefetch" href="/assets/js/233.36843a48.js"><link rel="prefetch" href="/assets/js/234.1e3e41c7.js"><link rel="prefetch" href="/assets/js/235.2dff4846.js"><link rel="prefetch" href="/assets/js/236.bb6fd980.js"><link rel="prefetch" href="/assets/js/237.e97364da.js"><link rel="prefetch" href="/assets/js/238.d8ce22f3.js"><link rel="prefetch" href="/assets/js/239.be791e5e.js"><link rel="prefetch" href="/assets/js/24.4b60795e.js"><link rel="prefetch" href="/assets/js/240.3927116f.js"><link rel="prefetch" href="/assets/js/241.6539a7f9.js"><link rel="prefetch" href="/assets/js/242.1241e424.js"><link rel="prefetch" href="/assets/js/243.a07d3be3.js"><link rel="prefetch" href="/assets/js/244.f98f98a1.js"><link rel="prefetch" href="/assets/js/245.ecb7c922.js"><link rel="prefetch" href="/assets/js/246.95ed23ce.js"><link rel="prefetch" href="/assets/js/247.fb5d42c6.js"><link rel="prefetch" href="/assets/js/248.f7b4f364.js"><link rel="prefetch" href="/assets/js/249.ac22d922.js"><link rel="prefetch" href="/assets/js/25.ef18cc01.js"><link rel="prefetch" href="/assets/js/250.01fbf76b.js"><link rel="prefetch" href="/assets/js/251.08f19bbd.js"><link rel="prefetch" href="/assets/js/252.9f11061d.js"><link rel="prefetch" href="/assets/js/253.cd7f85b9.js"><link rel="prefetch" href="/assets/js/254.2493e550.js"><link rel="prefetch" href="/assets/js/255.ac6d41ee.js"><link rel="prefetch" href="/assets/js/256.068eb5a6.js"><link rel="prefetch" href="/assets/js/257.b108c715.js"><link rel="prefetch" href="/assets/js/258.d614b5d4.js"><link rel="prefetch" href="/assets/js/259.87ba5ef3.js"><link rel="prefetch" href="/assets/js/26.5baa4d2c.js"><link rel="prefetch" href="/assets/js/260.c771e39d.js"><link rel="prefetch" href="/assets/js/261.0dbaf460.js"><link rel="prefetch" href="/assets/js/262.35e64a26.js"><link rel="prefetch" href="/assets/js/263.c16fca32.js"><link rel="prefetch" href="/assets/js/264.ea414912.js"><link rel="prefetch" href="/assets/js/265.f2e0d5bb.js"><link rel="prefetch" href="/assets/js/266.629a2d15.js"><link rel="prefetch" href="/assets/js/267.c7332e80.js"><link rel="prefetch" href="/assets/js/268.8be99f76.js"><link rel="prefetch" href="/assets/js/269.452ff2d4.js"><link rel="prefetch" href="/assets/js/27.2a2950d8.js"><link rel="prefetch" href="/assets/js/270.a5c429cb.js"><link rel="prefetch" href="/assets/js/271.1ad3cd83.js"><link rel="prefetch" href="/assets/js/272.354cef59.js"><link rel="prefetch" href="/assets/js/273.681156b7.js"><link rel="prefetch" href="/assets/js/274.6c51e7ae.js"><link rel="prefetch" href="/assets/js/275.24ef01b4.js"><link rel="prefetch" href="/assets/js/276.afeb2acd.js"><link rel="prefetch" href="/assets/js/277.6472c22d.js"><link rel="prefetch" href="/assets/js/278.416d9788.js"><link rel="prefetch" href="/assets/js/279.c190fbc9.js"><link rel="prefetch" href="/assets/js/28.6320d8c1.js"><link rel="prefetch" href="/assets/js/280.28b1b955.js"><link rel="prefetch" href="/assets/js/281.77afd7c5.js"><link rel="prefetch" href="/assets/js/282.eee0e9c0.js"><link rel="prefetch" href="/assets/js/283.e59fb0e5.js"><link rel="prefetch" href="/assets/js/284.9c6ff275.js"><link rel="prefetch" href="/assets/js/285.3e2d030a.js"><link rel="prefetch" href="/assets/js/286.d7562f9b.js"><link rel="prefetch" href="/assets/js/287.9e228e80.js"><link rel="prefetch" href="/assets/js/288.f9448d7d.js"><link rel="prefetch" href="/assets/js/289.30726f95.js"><link rel="prefetch" href="/assets/js/29.a420635f.js"><link rel="prefetch" href="/assets/js/290.f79765e2.js"><link rel="prefetch" href="/assets/js/291.0943618c.js"><link rel="prefetch" href="/assets/js/292.bd04f6db.js"><link rel="prefetch" href="/assets/js/293.776f4c0d.js"><link rel="prefetch" href="/assets/js/294.54e52863.js"><link rel="prefetch" href="/assets/js/295.bd033d69.js"><link rel="prefetch" href="/assets/js/296.1090c539.js"><link rel="prefetch" href="/assets/js/297.ec37f6e8.js"><link rel="prefetch" href="/assets/js/298.fa434214.js"><link rel="prefetch" href="/assets/js/299.50bd7c87.js"><link rel="prefetch" href="/assets/js/30.6c81ca7b.js"><link rel="prefetch" href="/assets/js/300.7a2c6632.js"><link rel="prefetch" href="/assets/js/301.4ae4e645.js"><link rel="prefetch" href="/assets/js/302.e1ef7459.js"><link rel="prefetch" href="/assets/js/303.3894068b.js"><link rel="prefetch" href="/assets/js/304.840b09e3.js"><link rel="prefetch" href="/assets/js/305.40ec0bf6.js"><link rel="prefetch" href="/assets/js/306.9fa4d8aa.js"><link rel="prefetch" href="/assets/js/307.33656e76.js"><link rel="prefetch" href="/assets/js/308.19398f71.js"><link rel="prefetch" href="/assets/js/309.bde6f12f.js"><link rel="prefetch" href="/assets/js/31.2b4f2752.js"><link rel="prefetch" href="/assets/js/310.69ced632.js"><link rel="prefetch" href="/assets/js/311.c8e57d0e.js"><link rel="prefetch" href="/assets/js/312.80c4d6a7.js"><link rel="prefetch" href="/assets/js/313.14060a06.js"><link rel="prefetch" href="/assets/js/314.29165d83.js"><link rel="prefetch" href="/assets/js/315.901aabf1.js"><link rel="prefetch" href="/assets/js/316.7f0d18e3.js"><link rel="prefetch" href="/assets/js/317.112de6ec.js"><link rel="prefetch" href="/assets/js/318.091ea533.js"><link rel="prefetch" href="/assets/js/319.25ca175e.js"><link rel="prefetch" href="/assets/js/32.ab03e16f.js"><link rel="prefetch" href="/assets/js/320.b89e85c9.js"><link rel="prefetch" href="/assets/js/321.69316136.js"><link rel="prefetch" href="/assets/js/322.567512f0.js"><link rel="prefetch" href="/assets/js/323.2d67bb75.js"><link rel="prefetch" href="/assets/js/324.c41411db.js"><link rel="prefetch" href="/assets/js/325.a412ca77.js"><link rel="prefetch" href="/assets/js/326.22408ce6.js"><link rel="prefetch" href="/assets/js/327.33524443.js"><link rel="prefetch" href="/assets/js/328.561ebeb1.js"><link rel="prefetch" href="/assets/js/329.d7a280e4.js"><link rel="prefetch" href="/assets/js/33.199f45ed.js"><link rel="prefetch" href="/assets/js/330.d01a7e1b.js"><link rel="prefetch" href="/assets/js/331.a3ad2556.js"><link rel="prefetch" href="/assets/js/332.36ad912a.js"><link rel="prefetch" href="/assets/js/333.2fb229c4.js"><link rel="prefetch" href="/assets/js/334.d170f507.js"><link rel="prefetch" href="/assets/js/335.90ca0539.js"><link rel="prefetch" href="/assets/js/336.454d4374.js"><link rel="prefetch" href="/assets/js/337.dba45eb4.js"><link rel="prefetch" href="/assets/js/338.c8e4ba66.js"><link rel="prefetch" href="/assets/js/339.ae85118e.js"><link rel="prefetch" href="/assets/js/34.d0c7a02e.js"><link rel="prefetch" href="/assets/js/340.7033b85b.js"><link rel="prefetch" href="/assets/js/341.13cfe1aa.js"><link rel="prefetch" href="/assets/js/342.b33302b5.js"><link rel="prefetch" href="/assets/js/343.946f30dc.js"><link rel="prefetch" href="/assets/js/344.b2add405.js"><link rel="prefetch" href="/assets/js/345.12433fa3.js"><link rel="prefetch" href="/assets/js/346.b1bdfeba.js"><link rel="prefetch" href="/assets/js/347.53530bff.js"><link rel="prefetch" href="/assets/js/348.48aa580e.js"><link rel="prefetch" href="/assets/js/349.53c4baca.js"><link rel="prefetch" href="/assets/js/35.5512348f.js"><link rel="prefetch" href="/assets/js/350.e4b2d6e6.js"><link rel="prefetch" href="/assets/js/351.d41b01c1.js"><link rel="prefetch" href="/assets/js/352.1c4d1250.js"><link rel="prefetch" href="/assets/js/353.7fd27c0f.js"><link rel="prefetch" href="/assets/js/354.47199c90.js"><link rel="prefetch" href="/assets/js/355.68bccab4.js"><link rel="prefetch" href="/assets/js/356.e3602eb5.js"><link rel="prefetch" href="/assets/js/357.cd5ce764.js"><link rel="prefetch" href="/assets/js/358.bee621d4.js"><link rel="prefetch" href="/assets/js/359.648aa4f0.js"><link rel="prefetch" href="/assets/js/36.bdebdf29.js"><link rel="prefetch" href="/assets/js/360.439f5fae.js"><link rel="prefetch" href="/assets/js/361.39f782b4.js"><link rel="prefetch" href="/assets/js/362.106acf4c.js"><link rel="prefetch" href="/assets/js/363.562a4e1e.js"><link rel="prefetch" href="/assets/js/364.5940b069.js"><link rel="prefetch" href="/assets/js/365.e429c365.js"><link rel="prefetch" href="/assets/js/366.cc650df8.js"><link rel="prefetch" href="/assets/js/367.347592c9.js"><link rel="prefetch" href="/assets/js/368.d68ce88d.js"><link rel="prefetch" href="/assets/js/369.034e7f1e.js"><link rel="prefetch" href="/assets/js/37.9d026956.js"><link rel="prefetch" href="/assets/js/370.ac6fc7a5.js"><link rel="prefetch" href="/assets/js/371.e70219a6.js"><link rel="prefetch" href="/assets/js/372.c449fc49.js"><link rel="prefetch" href="/assets/js/373.f07bea72.js"><link rel="prefetch" href="/assets/js/374.8152408f.js"><link rel="prefetch" href="/assets/js/375.63c70dab.js"><link rel="prefetch" href="/assets/js/376.06de19db.js"><link rel="prefetch" href="/assets/js/377.2319ddb1.js"><link rel="prefetch" href="/assets/js/378.4821e23c.js"><link rel="prefetch" href="/assets/js/379.54a13769.js"><link rel="prefetch" href="/assets/js/38.23e83578.js"><link rel="prefetch" href="/assets/js/380.dac4cd46.js"><link rel="prefetch" href="/assets/js/381.8f83d1d7.js"><link rel="prefetch" href="/assets/js/382.e76e7d88.js"><link rel="prefetch" href="/assets/js/383.df731ee4.js"><link rel="prefetch" href="/assets/js/384.5093369e.js"><link rel="prefetch" href="/assets/js/385.ee576341.js"><link rel="prefetch" href="/assets/js/386.087a29a9.js"><link rel="prefetch" href="/assets/js/387.9f44d03b.js"><link rel="prefetch" href="/assets/js/388.a3f70992.js"><link rel="prefetch" href="/assets/js/389.df6e2ced.js"><link rel="prefetch" href="/assets/js/39.e9699d7f.js"><link rel="prefetch" href="/assets/js/390.c377efca.js"><link rel="prefetch" href="/assets/js/391.d7747385.js"><link rel="prefetch" href="/assets/js/392.bf8e8c1a.js"><link rel="prefetch" href="/assets/js/393.b4ed3be0.js"><link rel="prefetch" href="/assets/js/394.48eb505a.js"><link rel="prefetch" href="/assets/js/395.d9cd4812.js"><link rel="prefetch" href="/assets/js/396.b386a6b5.js"><link rel="prefetch" href="/assets/js/397.d19960fa.js"><link rel="prefetch" href="/assets/js/398.15f66e2a.js"><link rel="prefetch" href="/assets/js/399.cc4af83b.js"><link rel="prefetch" href="/assets/js/40.3a541653.js"><link rel="prefetch" href="/assets/js/400.d99e4b93.js"><link rel="prefetch" href="/assets/js/401.13fa06dd.js"><link rel="prefetch" href="/assets/js/402.3629b866.js"><link rel="prefetch" href="/assets/js/403.5826b040.js"><link rel="prefetch" href="/assets/js/404.d4b35549.js"><link rel="prefetch" href="/assets/js/405.9142a002.js"><link rel="prefetch" href="/assets/js/406.ba50e04d.js"><link rel="prefetch" href="/assets/js/407.b5271c6f.js"><link rel="prefetch" href="/assets/js/408.18baa241.js"><link rel="prefetch" href="/assets/js/409.6151d46b.js"><link rel="prefetch" href="/assets/js/41.b10ef41f.js"><link rel="prefetch" href="/assets/js/410.bb1fd058.js"><link rel="prefetch" href="/assets/js/411.9273fd47.js"><link rel="prefetch" href="/assets/js/412.d6b790c1.js"><link rel="prefetch" href="/assets/js/413.4c5a30bb.js"><link rel="prefetch" href="/assets/js/414.01aa0e0a.js"><link rel="prefetch" href="/assets/js/415.2633ad61.js"><link rel="prefetch" href="/assets/js/416.7a2263a9.js"><link rel="prefetch" href="/assets/js/417.98368241.js"><link rel="prefetch" href="/assets/js/418.ffeb9c9c.js"><link rel="prefetch" href="/assets/js/419.633f9efe.js"><link rel="prefetch" href="/assets/js/42.aa8b7c99.js"><link rel="prefetch" href="/assets/js/420.69868f4a.js"><link rel="prefetch" href="/assets/js/421.937d87cc.js"><link rel="prefetch" href="/assets/js/422.375fe09b.js"><link rel="prefetch" href="/assets/js/423.8d335fd6.js"><link rel="prefetch" href="/assets/js/424.d5b181d7.js"><link rel="prefetch" href="/assets/js/425.e06749ea.js"><link rel="prefetch" href="/assets/js/426.d7a23361.js"><link rel="prefetch" href="/assets/js/427.c26079c3.js"><link rel="prefetch" href="/assets/js/428.788e60b3.js"><link rel="prefetch" href="/assets/js/429.212c3091.js"><link rel="prefetch" href="/assets/js/43.bbf1f09a.js"><link rel="prefetch" href="/assets/js/430.e156b1fa.js"><link rel="prefetch" href="/assets/js/431.b41e44c6.js"><link rel="prefetch" href="/assets/js/432.7534e280.js"><link rel="prefetch" href="/assets/js/433.3d203e2b.js"><link rel="prefetch" href="/assets/js/434.41bb5350.js"><link rel="prefetch" href="/assets/js/435.a5c93fd3.js"><link rel="prefetch" href="/assets/js/436.60910866.js"><link rel="prefetch" href="/assets/js/437.7ae74f40.js"><link rel="prefetch" href="/assets/js/438.dc802af3.js"><link rel="prefetch" href="/assets/js/439.0de7c2a4.js"><link rel="prefetch" href="/assets/js/44.c0079627.js"><link rel="prefetch" href="/assets/js/440.43bc725f.js"><link rel="prefetch" href="/assets/js/441.1402dd2a.js"><link rel="prefetch" href="/assets/js/442.6106e1be.js"><link rel="prefetch" href="/assets/js/443.40909ac7.js"><link rel="prefetch" href="/assets/js/444.e506898d.js"><link rel="prefetch" href="/assets/js/445.8636f7a3.js"><link rel="prefetch" href="/assets/js/446.de915ed4.js"><link rel="prefetch" href="/assets/js/447.c7ac8e6e.js"><link rel="prefetch" href="/assets/js/448.9797a750.js"><link rel="prefetch" href="/assets/js/449.5d1f4748.js"><link rel="prefetch" href="/assets/js/45.2a09d581.js"><link rel="prefetch" href="/assets/js/450.42babefe.js"><link rel="prefetch" href="/assets/js/451.ee1b8ff8.js"><link rel="prefetch" href="/assets/js/452.7536e7c2.js"><link rel="prefetch" href="/assets/js/453.39a21d52.js"><link rel="prefetch" href="/assets/js/454.6511d1e1.js"><link rel="prefetch" href="/assets/js/455.2abb8ea0.js"><link rel="prefetch" href="/assets/js/456.5724d799.js"><link rel="prefetch" href="/assets/js/457.c32c0755.js"><link rel="prefetch" href="/assets/js/458.f67c539b.js"><link rel="prefetch" href="/assets/js/459.1634e8da.js"><link rel="prefetch" href="/assets/js/46.58b302e4.js"><link rel="prefetch" href="/assets/js/460.a22ac002.js"><link rel="prefetch" href="/assets/js/461.2c152148.js"><link rel="prefetch" href="/assets/js/462.14b038cf.js"><link rel="prefetch" href="/assets/js/463.dd0a3a00.js"><link rel="prefetch" href="/assets/js/464.f22ba288.js"><link rel="prefetch" href="/assets/js/465.9c187041.js"><link rel="prefetch" href="/assets/js/466.9957dd67.js"><link rel="prefetch" href="/assets/js/467.047041e8.js"><link rel="prefetch" href="/assets/js/468.425b6f20.js"><link rel="prefetch" href="/assets/js/469.2f70ecf7.js"><link rel="prefetch" href="/assets/js/47.987d79be.js"><link rel="prefetch" href="/assets/js/470.602b7d98.js"><link rel="prefetch" href="/assets/js/471.ddabe1b6.js"><link rel="prefetch" href="/assets/js/472.3a1ad521.js"><link rel="prefetch" href="/assets/js/473.2be352ab.js"><link rel="prefetch" href="/assets/js/474.e9c805de.js"><link rel="prefetch" href="/assets/js/475.93cab6cb.js"><link rel="prefetch" href="/assets/js/476.89384fa4.js"><link rel="prefetch" href="/assets/js/477.2b282ee8.js"><link rel="prefetch" href="/assets/js/478.27790491.js"><link rel="prefetch" href="/assets/js/479.2b728ba6.js"><link rel="prefetch" href="/assets/js/48.0e76d761.js"><link rel="prefetch" href="/assets/js/480.bd0beea9.js"><link rel="prefetch" href="/assets/js/481.004a0005.js"><link rel="prefetch" href="/assets/js/482.d9c6dc45.js"><link rel="prefetch" href="/assets/js/483.e7842361.js"><link rel="prefetch" href="/assets/js/484.702ac9a3.js"><link rel="prefetch" href="/assets/js/485.d38ba4c2.js"><link rel="prefetch" href="/assets/js/486.8a0cd211.js"><link rel="prefetch" href="/assets/js/487.18e243bb.js"><link rel="prefetch" href="/assets/js/488.cb0ad1bf.js"><link rel="prefetch" href="/assets/js/489.7c7adc5c.js"><link rel="prefetch" href="/assets/js/49.83e0619b.js"><link rel="prefetch" href="/assets/js/490.3f86a6a4.js"><link rel="prefetch" href="/assets/js/491.c1c90b4f.js"><link rel="prefetch" href="/assets/js/492.5658313d.js"><link rel="prefetch" href="/assets/js/493.9b953b18.js"><link rel="prefetch" href="/assets/js/494.80e3d4f4.js"><link rel="prefetch" href="/assets/js/495.66650a67.js"><link rel="prefetch" href="/assets/js/496.4e0d753b.js"><link rel="prefetch" href="/assets/js/497.1837b7c2.js"><link rel="prefetch" href="/assets/js/498.e2dcd450.js"><link rel="prefetch" href="/assets/js/499.4d5022f2.js"><link rel="prefetch" href="/assets/js/5.f343fd5d.js"><link rel="prefetch" href="/assets/js/50.6716fe91.js"><link rel="prefetch" href="/assets/js/500.10c0ee69.js"><link rel="prefetch" href="/assets/js/501.be3f9599.js"><link rel="prefetch" href="/assets/js/502.27844894.js"><link rel="prefetch" href="/assets/js/503.15f84a9b.js"><link rel="prefetch" href="/assets/js/504.60780a8e.js"><link rel="prefetch" href="/assets/js/505.6f9bed41.js"><link rel="prefetch" href="/assets/js/506.3e19b413.js"><link rel="prefetch" href="/assets/js/507.a12a02cb.js"><link rel="prefetch" href="/assets/js/508.b1384524.js"><link rel="prefetch" href="/assets/js/509.c74ef6c0.js"><link rel="prefetch" href="/assets/js/51.bc8d5aaf.js"><link rel="prefetch" href="/assets/js/510.266a6048.js"><link rel="prefetch" href="/assets/js/511.be98a2ef.js"><link rel="prefetch" href="/assets/js/512.e033e89e.js"><link rel="prefetch" href="/assets/js/513.837b9052.js"><link rel="prefetch" href="/assets/js/514.38271d19.js"><link rel="prefetch" href="/assets/js/515.c08327b5.js"><link rel="prefetch" href="/assets/js/516.3d573fdf.js"><link rel="prefetch" href="/assets/js/517.5406a8bd.js"><link rel="prefetch" href="/assets/js/518.543bea6f.js"><link rel="prefetch" href="/assets/js/519.e4967ce6.js"><link rel="prefetch" href="/assets/js/52.20603f07.js"><link rel="prefetch" href="/assets/js/520.0a863135.js"><link rel="prefetch" href="/assets/js/521.80c26149.js"><link rel="prefetch" href="/assets/js/522.5d0549ee.js"><link rel="prefetch" href="/assets/js/523.4b5d705c.js"><link rel="prefetch" href="/assets/js/524.24354cd8.js"><link rel="prefetch" href="/assets/js/525.d201b688.js"><link rel="prefetch" href="/assets/js/526.f405c35a.js"><link rel="prefetch" href="/assets/js/527.921d252f.js"><link rel="prefetch" href="/assets/js/528.cb45a5dd.js"><link rel="prefetch" href="/assets/js/529.aeec69e2.js"><link rel="prefetch" href="/assets/js/53.9604c447.js"><link rel="prefetch" href="/assets/js/530.7d5514c0.js"><link rel="prefetch" href="/assets/js/531.de381ab2.js"><link rel="prefetch" href="/assets/js/532.31b6e993.js"><link rel="prefetch" href="/assets/js/533.23335bff.js"><link rel="prefetch" href="/assets/js/534.131d260d.js"><link rel="prefetch" href="/assets/js/535.3057e7f2.js"><link rel="prefetch" href="/assets/js/536.1df4cc6e.js"><link rel="prefetch" href="/assets/js/537.c23a3391.js"><link rel="prefetch" href="/assets/js/538.ac3546d3.js"><link rel="prefetch" href="/assets/js/539.36137525.js"><link rel="prefetch" href="/assets/js/54.841e8e8f.js"><link rel="prefetch" href="/assets/js/540.f9171241.js"><link rel="prefetch" href="/assets/js/541.00a9732f.js"><link rel="prefetch" href="/assets/js/542.d981dcf7.js"><link rel="prefetch" href="/assets/js/543.0016cdef.js"><link rel="prefetch" href="/assets/js/544.b24fa17d.js"><link rel="prefetch" href="/assets/js/545.8adcd15c.js"><link rel="prefetch" href="/assets/js/546.189f10ef.js"><link rel="prefetch" href="/assets/js/547.d47175ac.js"><link rel="prefetch" href="/assets/js/548.67ed7a21.js"><link rel="prefetch" href="/assets/js/549.a72c957e.js"><link rel="prefetch" href="/assets/js/55.eccc64f8.js"><link rel="prefetch" href="/assets/js/550.c127415f.js"><link rel="prefetch" href="/assets/js/551.288648b2.js"><link rel="prefetch" href="/assets/js/552.5191109c.js"><link rel="prefetch" href="/assets/js/553.a0417c79.js"><link rel="prefetch" href="/assets/js/554.05224c83.js"><link rel="prefetch" href="/assets/js/555.d95f24bd.js"><link rel="prefetch" href="/assets/js/556.42a17364.js"><link rel="prefetch" href="/assets/js/557.a066d457.js"><link rel="prefetch" href="/assets/js/558.1f4641c3.js"><link rel="prefetch" href="/assets/js/559.f85fd85a.js"><link rel="prefetch" href="/assets/js/56.9ede6cf7.js"><link rel="prefetch" href="/assets/js/560.c486ead6.js"><link rel="prefetch" href="/assets/js/561.5654ef71.js"><link rel="prefetch" href="/assets/js/562.8ac06965.js"><link rel="prefetch" href="/assets/js/563.209407dd.js"><link rel="prefetch" href="/assets/js/564.4da5848b.js"><link rel="prefetch" href="/assets/js/565.0ea0c2cb.js"><link rel="prefetch" href="/assets/js/566.fbb62b05.js"><link rel="prefetch" href="/assets/js/567.0454bee2.js"><link rel="prefetch" href="/assets/js/568.5aad57f8.js"><link rel="prefetch" href="/assets/js/569.b4b199ad.js"><link rel="prefetch" href="/assets/js/57.2e9b38e9.js"><link rel="prefetch" href="/assets/js/570.890f1d05.js"><link rel="prefetch" href="/assets/js/571.56e5f721.js"><link rel="prefetch" href="/assets/js/572.fa3418f1.js"><link rel="prefetch" href="/assets/js/573.224ada77.js"><link rel="prefetch" href="/assets/js/574.4cc85330.js"><link rel="prefetch" href="/assets/js/575.61a17f5e.js"><link rel="prefetch" href="/assets/js/576.0ec5efb8.js"><link rel="prefetch" href="/assets/js/577.6bc915dd.js"><link rel="prefetch" href="/assets/js/578.fd4e39e7.js"><link rel="prefetch" href="/assets/js/579.0238c950.js"><link rel="prefetch" href="/assets/js/58.f28ad3cc.js"><link rel="prefetch" href="/assets/js/580.a08c6c02.js"><link rel="prefetch" href="/assets/js/581.392f9c6f.js"><link rel="prefetch" href="/assets/js/582.2f59e9f2.js"><link rel="prefetch" href="/assets/js/583.2097fe85.js"><link rel="prefetch" href="/assets/js/584.f0d8c622.js"><link rel="prefetch" href="/assets/js/585.85fab1f2.js"><link rel="prefetch" href="/assets/js/586.c359098c.js"><link rel="prefetch" href="/assets/js/587.1dff90c3.js"><link rel="prefetch" href="/assets/js/588.6afc16eb.js"><link rel="prefetch" href="/assets/js/589.4337cfee.js"><link rel="prefetch" href="/assets/js/59.9079a4f5.js"><link rel="prefetch" href="/assets/js/590.f969cc18.js"><link rel="prefetch" href="/assets/js/591.dfceaca2.js"><link rel="prefetch" href="/assets/js/592.b670f7b8.js"><link rel="prefetch" href="/assets/js/593.85ff3e7e.js"><link rel="prefetch" href="/assets/js/594.87d3c73b.js"><link rel="prefetch" href="/assets/js/595.18f2a1df.js"><link rel="prefetch" href="/assets/js/596.adb07b39.js"><link rel="prefetch" href="/assets/js/597.4bfdae44.js"><link rel="prefetch" href="/assets/js/598.a4f73bf5.js"><link rel="prefetch" href="/assets/js/599.5b85b7f2.js"><link rel="prefetch" href="/assets/js/6.6f5ae702.js"><link rel="prefetch" href="/assets/js/60.3095e21a.js"><link rel="prefetch" href="/assets/js/600.98cef029.js"><link rel="prefetch" href="/assets/js/601.34cfecd2.js"><link rel="prefetch" href="/assets/js/602.afaf2e1f.js"><link rel="prefetch" href="/assets/js/603.5f081041.js"><link rel="prefetch" href="/assets/js/604.a55dc3e4.js"><link rel="prefetch" href="/assets/js/605.cc600bca.js"><link rel="prefetch" href="/assets/js/606.9e0874e1.js"><link rel="prefetch" href="/assets/js/607.bd0a2835.js"><link rel="prefetch" href="/assets/js/608.e3c0bb6d.js"><link rel="prefetch" href="/assets/js/609.968adfbe.js"><link rel="prefetch" href="/assets/js/61.cd58c0e2.js"><link rel="prefetch" href="/assets/js/610.6ddb82e2.js"><link rel="prefetch" href="/assets/js/611.f6573e33.js"><link rel="prefetch" href="/assets/js/612.cd703232.js"><link rel="prefetch" href="/assets/js/613.5ae48097.js"><link rel="prefetch" href="/assets/js/614.c9fc5628.js"><link rel="prefetch" href="/assets/js/615.5f3c1162.js"><link rel="prefetch" href="/assets/js/616.3efeed17.js"><link rel="prefetch" href="/assets/js/617.25dec672.js"><link rel="prefetch" href="/assets/js/618.b53f21b6.js"><link rel="prefetch" href="/assets/js/619.e0c2de74.js"><link rel="prefetch" href="/assets/js/62.aa4d202d.js"><link rel="prefetch" href="/assets/js/620.88136c6a.js"><link rel="prefetch" href="/assets/js/621.494122df.js"><link rel="prefetch" href="/assets/js/622.e2a6e4bd.js"><link rel="prefetch" href="/assets/js/623.20a56d61.js"><link rel="prefetch" href="/assets/js/624.602dd933.js"><link rel="prefetch" href="/assets/js/625.70f44f60.js"><link rel="prefetch" href="/assets/js/626.11524978.js"><link rel="prefetch" href="/assets/js/627.b3badb72.js"><link rel="prefetch" href="/assets/js/628.e613665e.js"><link rel="prefetch" href="/assets/js/629.20e73b43.js"><link rel="prefetch" href="/assets/js/63.f7cd40f4.js"><link rel="prefetch" href="/assets/js/630.6099312f.js"><link rel="prefetch" href="/assets/js/631.669bcda0.js"><link rel="prefetch" href="/assets/js/632.d33f5ec9.js"><link rel="prefetch" href="/assets/js/633.211456ee.js"><link rel="prefetch" href="/assets/js/634.ea9d07ae.js"><link rel="prefetch" href="/assets/js/635.f22368f1.js"><link rel="prefetch" href="/assets/js/636.ebe249f7.js"><link rel="prefetch" href="/assets/js/637.7b645ab3.js"><link rel="prefetch" href="/assets/js/638.4565c395.js"><link rel="prefetch" href="/assets/js/639.c5144f9c.js"><link rel="prefetch" href="/assets/js/64.8cd3aa43.js"><link rel="prefetch" href="/assets/js/640.2dc2eba9.js"><link rel="prefetch" href="/assets/js/641.70155ce7.js"><link rel="prefetch" href="/assets/js/642.c55f5ca8.js"><link rel="prefetch" href="/assets/js/643.69a5b8e5.js"><link rel="prefetch" href="/assets/js/644.84431935.js"><link rel="prefetch" href="/assets/js/645.5119ebc2.js"><link rel="prefetch" href="/assets/js/646.506fc745.js"><link rel="prefetch" href="/assets/js/647.e5f03652.js"><link rel="prefetch" href="/assets/js/648.47ae0cc5.js"><link rel="prefetch" href="/assets/js/649.b3a67529.js"><link rel="prefetch" href="/assets/js/65.14b3da5d.js"><link rel="prefetch" href="/assets/js/650.89765bb0.js"><link rel="prefetch" href="/assets/js/651.19b73cf8.js"><link rel="prefetch" href="/assets/js/652.4436725f.js"><link rel="prefetch" href="/assets/js/653.391168ff.js"><link rel="prefetch" href="/assets/js/654.8b449d07.js"><link rel="prefetch" href="/assets/js/655.27051c8c.js"><link rel="prefetch" href="/assets/js/656.7adaae31.js"><link rel="prefetch" href="/assets/js/657.4fee46d2.js"><link rel="prefetch" href="/assets/js/658.0243a6e8.js"><link rel="prefetch" href="/assets/js/659.f69398bc.js"><link rel="prefetch" href="/assets/js/66.899fc260.js"><link rel="prefetch" href="/assets/js/660.5e51ab7c.js"><link rel="prefetch" href="/assets/js/661.980d3d5a.js"><link rel="prefetch" href="/assets/js/662.79643730.js"><link rel="prefetch" href="/assets/js/663.d030bd1d.js"><link rel="prefetch" href="/assets/js/664.32b3c0e8.js"><link rel="prefetch" href="/assets/js/665.384c456b.js"><link rel="prefetch" href="/assets/js/666.2672eb36.js"><link rel="prefetch" href="/assets/js/667.2ca85ff9.js"><link rel="prefetch" href="/assets/js/668.b80ef3b4.js"><link rel="prefetch" href="/assets/js/669.41f08cb1.js"><link rel="prefetch" href="/assets/js/67.c0e799e4.js"><link rel="prefetch" href="/assets/js/670.48512f45.js"><link rel="prefetch" href="/assets/js/671.93e1cdd9.js"><link rel="prefetch" href="/assets/js/672.aa2a7e31.js"><link rel="prefetch" href="/assets/js/673.b19ed80d.js"><link rel="prefetch" href="/assets/js/674.0337bf32.js"><link rel="prefetch" href="/assets/js/675.88a9d569.js"><link rel="prefetch" href="/assets/js/676.7fd2de1c.js"><link rel="prefetch" href="/assets/js/677.1356b477.js"><link rel="prefetch" href="/assets/js/678.d99fd658.js"><link rel="prefetch" href="/assets/js/679.a2e40bc7.js"><link rel="prefetch" href="/assets/js/68.2e72dacb.js"><link rel="prefetch" href="/assets/js/680.58e5d76e.js"><link rel="prefetch" href="/assets/js/681.2e66d773.js"><link rel="prefetch" href="/assets/js/682.42526013.js"><link rel="prefetch" href="/assets/js/683.447d4972.js"><link rel="prefetch" href="/assets/js/684.19beb22a.js"><link rel="prefetch" href="/assets/js/685.cd3fd615.js"><link rel="prefetch" href="/assets/js/686.c6200f3f.js"><link rel="prefetch" href="/assets/js/687.3d6cf8bb.js"><link rel="prefetch" href="/assets/js/688.e9ddd041.js"><link rel="prefetch" href="/assets/js/689.74bb6414.js"><link rel="prefetch" href="/assets/js/69.d29a7787.js"><link rel="prefetch" href="/assets/js/690.82b51acd.js"><link rel="prefetch" href="/assets/js/691.a6edc5c3.js"><link rel="prefetch" href="/assets/js/692.c5fd2fa7.js"><link rel="prefetch" href="/assets/js/693.0c0b8126.js"><link rel="prefetch" href="/assets/js/694.551ae4d1.js"><link rel="prefetch" href="/assets/js/695.2801a2f2.js"><link rel="prefetch" href="/assets/js/696.8723006b.js"><link rel="prefetch" href="/assets/js/697.275e71c7.js"><link rel="prefetch" href="/assets/js/698.431e2bfb.js"><link rel="prefetch" href="/assets/js/699.c82907d3.js"><link rel="prefetch" href="/assets/js/7.c8b0ee6b.js"><link rel="prefetch" href="/assets/js/70.53b18677.js"><link rel="prefetch" href="/assets/js/700.9faf8917.js"><link rel="prefetch" href="/assets/js/701.5ce77f04.js"><link rel="prefetch" href="/assets/js/702.488262eb.js"><link rel="prefetch" href="/assets/js/703.8f79363d.js"><link rel="prefetch" href="/assets/js/704.a4cfe8cb.js"><link rel="prefetch" href="/assets/js/705.4f1759eb.js"><link rel="prefetch" href="/assets/js/706.baf03b10.js"><link rel="prefetch" href="/assets/js/707.48c01840.js"><link rel="prefetch" href="/assets/js/708.b3cda177.js"><link rel="prefetch" href="/assets/js/709.260cc3a8.js"><link rel="prefetch" href="/assets/js/71.b44506bc.js"><link rel="prefetch" href="/assets/js/710.e4fa6646.js"><link rel="prefetch" href="/assets/js/711.7816aba5.js"><link rel="prefetch" href="/assets/js/712.14939ffd.js"><link rel="prefetch" href="/assets/js/72.9793c1ce.js"><link rel="prefetch" href="/assets/js/73.b4d37c7e.js"><link rel="prefetch" href="/assets/js/74.b816cbc7.js"><link rel="prefetch" href="/assets/js/75.9f45a274.js"><link rel="prefetch" href="/assets/js/76.4921e235.js"><link rel="prefetch" href="/assets/js/77.f9258c97.js"><link rel="prefetch" href="/assets/js/78.55656c0f.js"><link rel="prefetch" href="/assets/js/79.b5784c72.js"><link rel="prefetch" href="/assets/js/8.44118d7c.js"><link rel="prefetch" href="/assets/js/80.98240933.js"><link rel="prefetch" href="/assets/js/81.5421fa90.js"><link rel="prefetch" href="/assets/js/82.72a10ccf.js"><link rel="prefetch" href="/assets/js/83.abdca93e.js"><link rel="prefetch" href="/assets/js/84.5d0190e3.js"><link rel="prefetch" href="/assets/js/85.5d2a1647.js"><link rel="prefetch" href="/assets/js/86.5aea5730.js"><link rel="prefetch" href="/assets/js/87.bfe2bb57.js"><link rel="prefetch" href="/assets/js/88.4097611c.js"><link rel="prefetch" href="/assets/js/89.e5a98da0.js"><link rel="prefetch" href="/assets/js/9.612b54fd.js"><link rel="prefetch" href="/assets/js/90.5564a69b.js"><link rel="prefetch" href="/assets/js/91.ff219511.js"><link rel="prefetch" href="/assets/js/92.8191f073.js"><link rel="prefetch" href="/assets/js/93.4b6ecb16.js"><link rel="prefetch" href="/assets/js/94.fd999a73.js"><link rel="prefetch" href="/assets/js/95.c96c310d.js"><link rel="prefetch" href="/assets/js/96.2eb0ab2f.js"><link rel="prefetch" href="/assets/js/97.4c8c6fba.js"><link rel="prefetch" href="/assets/js/98.f9ef7bdb.js"><link rel="prefetch" href="/assets/js/99.513483d0.js"><link rel="prefetch" href="/assets/js/vendors~docsearch.49ad9c45.js">
    <link rel="stylesheet" href="/assets/css/0.styles.af3770e9.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/en/" class="home-link router-link-active"><img src="/images/icons/spring-logo.svg" alt="Spring Docs" class="logo"> <span class="site-name can-hide">Spring Docs</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/en/spring/why-spring.html" class="nav-link">
  Spring
</a></div><div class="nav-item"><a href="/en/spring-boot/getting-help.html" class="nav-link">
  Spring Boot
</a></div><div class="nav-item"><a href="/en/spring-cloud/documentation-overview.html" class="nav-link">
  Spring Cloud
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Others" class="dropdown-title"><span class="title">more</span> <span class="arrow down"></span></button> <button type="button" aria-label="Others" class="mobile-dropdown-title"><span class="title">more</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/en/spring-framework/overview.html" class="nav-link">
  Spring Framework
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-data/spring-data.html" class="nav-link">
  Spring Data
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-cloud-data-flow/spring-cloud-dataflow.html" class="nav-link">
  Spring Cloud Data Flow
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-security/overview.html" class="nav-link">
  Spring Security
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-for-graphql/spring-graphql.html" class="nav-link">
  Spring for GraphQL
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-session/_index.html" class="nav-link">
  Spring Session
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-integration/preface.html" class="nav-link">
  Spring Integration
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-hateoas/spring-hateoas.html" class="nav-link">
  Spring HATEOAS
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-rest-docs/spring-restdocs.html" class="nav-link">
  Spring REST Docs
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-batch/spring-batch-intro.html" class="nav-link">
  Spring Batch
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-amqp/spring-amqp.html" class="nav-link">
  Spring AMQP
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-credhub/spring-credhub.html" class="nav-link">
  Spring CredHub
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-flo/spring-flo.html" class="nav-link">
  Spring Flo
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-for-apache-kafka/spring-kafka.html" class="nav-link">
  Spring for Apache Kafka
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-ldap/spring-ldap.html" class="nav-link">
  Spring LDAP
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-shell/spring-shell.html" class="nav-link">
  Spring Shell
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-statemachine/spring-statemachine.html" class="nav-link">
  Spring Statemachine
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-vault/spring-vault.html" class="nav-link">
  Spring Vault
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-web-flow/preface.html" class="nav-link">
  Spring Web Flow
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-web-services/spring-web-service.html" class="nav-link">
  Spring Web Services
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Select language" class="dropdown-title"><span class="title">Language</span> <span class="arrow down"></span></button> <button type="button" aria-label="Select language" class="mobile-dropdown-title"><span class="title">Language</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/en/spring-integration/message-transformation.html" aria-current="page" class="nav-link router-link-exact-active router-link-active">
  English
</a></li><li class="dropdown-item"><!----> <a href="/spring-integration/message-transformation.html" class="nav-link">
  简体中文
</a></li></ul></div></div> <a href="https://gitcode.net/dev-cloud/spring-docs" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitCode
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/en/spring/why-spring.html" class="nav-link">
  Spring
</a></div><div class="nav-item"><a href="/en/spring-boot/getting-help.html" class="nav-link">
  Spring Boot
</a></div><div class="nav-item"><a href="/en/spring-cloud/documentation-overview.html" class="nav-link">
  Spring Cloud
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Others" class="dropdown-title"><span class="title">more</span> <span class="arrow down"></span></button> <button type="button" aria-label="Others" class="mobile-dropdown-title"><span class="title">more</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/en/spring-framework/overview.html" class="nav-link">
  Spring Framework
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-data/spring-data.html" class="nav-link">
  Spring Data
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-cloud-data-flow/spring-cloud-dataflow.html" class="nav-link">
  Spring Cloud Data Flow
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-security/overview.html" class="nav-link">
  Spring Security
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-for-graphql/spring-graphql.html" class="nav-link">
  Spring for GraphQL
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-session/_index.html" class="nav-link">
  Spring Session
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-integration/preface.html" class="nav-link">
  Spring Integration
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-hateoas/spring-hateoas.html" class="nav-link">
  Spring HATEOAS
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-rest-docs/spring-restdocs.html" class="nav-link">
  Spring REST Docs
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-batch/spring-batch-intro.html" class="nav-link">
  Spring Batch
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-amqp/spring-amqp.html" class="nav-link">
  Spring AMQP
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-credhub/spring-credhub.html" class="nav-link">
  Spring CredHub
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-flo/spring-flo.html" class="nav-link">
  Spring Flo
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-for-apache-kafka/spring-kafka.html" class="nav-link">
  Spring for Apache Kafka
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-ldap/spring-ldap.html" class="nav-link">
  Spring LDAP
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-shell/spring-shell.html" class="nav-link">
  Spring Shell
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-statemachine/spring-statemachine.html" class="nav-link">
  Spring Statemachine
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-vault/spring-vault.html" class="nav-link">
  Spring Vault
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-web-flow/preface.html" class="nav-link">
  Spring Web Flow
</a></li><li class="dropdown-item"><!----> <a href="/en/spring-web-services/spring-web-service.html" class="nav-link">
  Spring Web Services
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Select language" class="dropdown-title"><span class="title">Language</span> <span class="arrow down"></span></button> <button type="button" aria-label="Select language" class="mobile-dropdown-title"><span class="title">Language</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/en/spring-integration/message-transformation.html" aria-current="page" class="nav-link router-link-exact-active router-link-active">
  English
</a></li><li class="dropdown-item"><!----> <a href="/spring-integration/message-transformation.html" class="nav-link">
  简体中文
</a></li></ul></div></div> <a href="https://gitcode.net/dev-cloud/spring-docs" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitCode
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Spring Integration</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/en/spring-integration/preface.html" class="sidebar-link">Preface</a></li><li><a href="/en/spring-integration/whats-new.html" class="sidebar-link">What’s New?</a></li><li><a href="/en/spring-integration/overview.html" class="sidebar-link">Overview of Spring Integration Framework</a></li><li><a href="/en/spring-integration/core.html" class="sidebar-link">Core Messaging</a></li><li><a href="/en/spring-integration/message.html" class="sidebar-link">Message</a></li><li><a href="/en/spring-integration/message-routing.html" class="sidebar-link">Message Routing</a></li><li><a href="/en/spring-integration/message-transformation.html" aria-current="page" class="active sidebar-link">Message Transformation</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/en/spring-integration/message-transformation.html#message-transformation-2" class="sidebar-link">Message Transformation</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/en/spring-integration/message-transformation.html#transformer" class="sidebar-link">Transformer</a></li><li class="sidebar-sub-header"><a href="/en/spring-integration/message-transformation.html#content-enricher" class="sidebar-link">Content Enricher</a></li><li class="sidebar-sub-header"><a href="/en/spring-integration/message-transformation.html#claim-check" class="sidebar-link">Claim Check</a></li><li class="sidebar-sub-header"><a href="/en/spring-integration/message-transformation.html#codec" class="sidebar-link">Codec</a></li></ul></li></ul></li><li><a href="/en/spring-integration/messaging-endpoints.html" class="sidebar-link">Messaging Endpoints</a></li><li><a href="/en/spring-integration/dsl.html" class="sidebar-link">Java DSL</a></li><li><a href="/en/spring-integration/kotlin-dsl.html" class="sidebar-link">Kotlin DSL</a></li><li><a href="/en/spring-integration/system-management.html" class="sidebar-link">System Management</a></li><li><a href="/en/spring-integration/reactive-streams.html" class="sidebar-link">Reactive Streams Support</a></li><li><a href="/en/spring-integration/endpoint-summary.html" class="sidebar-link">Integration Endpoints</a></li><li><a href="/en/spring-integration/amqp.html" class="sidebar-link">AMQP Support</a></li><li><a href="/en/spring-integration/event.html" class="sidebar-link">Spring ApplicationEvent Support</a></li><li><a href="/en/spring-integration/feed.html" class="sidebar-link">Feed Adapter</a></li><li><a href="/en/spring-integration/file.html" class="sidebar-link">File Support</a></li><li><a href="/en/spring-integration/ftp.html" class="sidebar-link">FTP/FTPS</a></li><li><a href="/en/spring-integration/gemfire.html" class="sidebar-link">Pivotal GemFire and Apache Geode Support</a></li><li><a href="/en/spring-integration/http.html" class="sidebar-link">HTTP Support</a></li><li><a href="/en/spring-integration/jdbc.html" class="sidebar-link">JDBC Support</a></li><li><a href="/en/spring-integration/jpa.html" class="sidebar-link">JPA Support</a></li><li><a href="/en/spring-integration/jms.html" class="sidebar-link">JMS Support</a></li><li><a href="/en/spring-integration/jmx.html" class="sidebar-link">JMX Support</a></li><li><a href="/en/spring-integration/kafka.html" class="sidebar-link">Apache Kafka Support</a></li><li><a href="/en/spring-integration/mail.html" class="sidebar-link">Mail Support</a></li><li><a href="/en/spring-integration/mongodb.html" class="sidebar-link">MongoDb Support</a></li><li><a href="/en/spring-integration/mqtt.html" class="sidebar-link">MQTT Support</a></li><li><a href="/en/spring-integration/r2dbc.html" class="sidebar-link">R2DBC Support</a></li><li><a href="/en/spring-integration/redis.html" class="sidebar-link">Redis Support</a></li><li><a href="/en/spring-integration/resource.html" class="sidebar-link">Resource Support</a></li><li><a href="/en/spring-integration/rmi.html" class="sidebar-link">RMI Support</a></li><li><a href="/en/spring-integration/rsocket.html" class="sidebar-link">RSocket Support</a></li><li><a href="/en/spring-integration/sftp.html" class="sidebar-link">SFTP Adapters</a></li><li><a href="/en/spring-integration/stomp.html" class="sidebar-link">STOMP Support</a></li><li><a href="/en/spring-integration/stream.html" class="sidebar-link">Stream Support</a></li><li><a href="/en/spring-integration/syslog.html" class="sidebar-link">Syslog Support</a></li><li><a href="/en/spring-integration/ip.html" class="sidebar-link">TCP and UDP Support</a></li><li><a href="/en/spring-integration/webflux.html" class="sidebar-link">WebFlux Support</a></li><li><a href="/en/spring-integration/web-sockets.html" class="sidebar-link">WebSockets Support</a></li><li><a href="/en/spring-integration/ws.html" class="sidebar-link">Web Services Support</a></li><li><a href="/en/spring-integration/xml.html" class="sidebar-link">XML Support - Dealing with XML Payloads</a></li><li><a href="/en/spring-integration/xmpp.html" class="sidebar-link">XMPP Support</a></li><li><a href="/en/spring-integration/zeromq.html" class="sidebar-link">ZeroMQ Support</a></li><li><a href="/en/spring-integration/zookeeper.html" class="sidebar-link">Zookeeper Support</a></li><li><a href="/en/spring-integration/error-handling.html" class="sidebar-link">Error Handling</a></li><li><a href="/en/spring-integration/spel.html" class="sidebar-link">Spring Expression Language (SpEL)</a></li><li><a href="/en/spring-integration/message-publishing.html" class="sidebar-link">Message Publishing</a></li><li><a href="/en/spring-integration/transactions.html" class="sidebar-link">Transaction Support</a></li><li><a href="/en/spring-integration/security.html" class="sidebar-link">Security in Spring Integration</a></li><li><a href="/en/spring-integration/configuration.html" class="sidebar-link">Configuration</a></li><li><a href="/en/spring-integration/testing.html" class="sidebar-link">Testing support</a></li><li><a href="/en/spring-integration/samples.html" class="sidebar-link">Spring Integration Samples</a></li><li><a href="/en/spring-integration/resources.html" class="sidebar-link">Additional Resources</a></li><li><a href="/en/spring-integration/history.html" class="sidebar-link">Change History</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="message-transformation"><a href="#message-transformation" class="header-anchor">#</a> Message Transformation</h1> <h2 id="message-transformation-2"><a href="#message-transformation-2" class="header-anchor">#</a> Message Transformation</h2> <h3 id="transformer"><a href="#transformer" class="header-anchor">#</a> Transformer</h3> <p>Message transformers play a very important role in enabling the loose-coupling of message producers and message consumers.
Rather than requiring every message-producing component to know what type is expected by the next consumer, you can add transformers between those components.
Generic transformers, such as one that converts a <code>String</code> to an XML Document, are also highly reusable.</p> <p>For some systems, it may be best to provide a <a href="https://www.enterpriseintegrationpatterns.com/CanonicalDataModel.html" target="_blank" rel="noopener noreferrer">canonical data model<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>, but Spring Integration’s general philosophy is not to require any particular format.
Rather, for maximum flexibility, Spring Integration aims to provide the simplest possible model for extension.
As with the other endpoint types, the use of declarative configuration in XML or Java annotations enables simple POJOs to be adapted for the role of message transformers.
The rest of this chapter describes these configuration options.</p> <table><thead><tr><th></th> <th>For the sake of maximizing flexibility, Spring does not require XML-based message payloads.<br>Nevertheless, the framework does provide some convenient transformers for dealing with XML-based payloads if that is indeed the right choice for your application.<br>For more information on those transformers, see <a href="/en/spring-integration/xml.html#xml">XML Support - Dealing with XML Payloads</a>.</th></tr></thead> <tbody></tbody></table> <h4 id="configuring-a-transformer-with-xml"><a href="#configuring-a-transformer-with-xml" class="header-anchor">#</a> Configuring a Transformer with XML</h4> <p>The <code>&lt;transformer&gt;</code> element is used to create a message-transforming endpoint.
In addition to <code>input-channel</code> and <code>output-channel</code> attributes, it requires a <code>ref</code> attribute.
The <code>ref</code> may either point to an object that contains the <code>@Transformer</code> annotation on a single method (see <a href="#transformer-annotation">Configuring a Transformer with Annotations</a>), or it may be combined with an explicit method name value provided in the <code>method</code> attribute.</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:transformer id=&quot;testTransformer&quot; ref=&quot;testTransformerBean&quot; input-channel=&quot;inChannel&quot;
             method=&quot;transform&quot; output-channel=&quot;outChannel&quot;/&gt;
&lt;beans:bean id=&quot;testTransformerBean&quot; class=&quot;org.foo.TestTransformer&quot; /&gt;
</code></pre></div><p>Using a <code>ref</code> attribute is generally recommended if the custom transformer handler implementation can be reused in other <code>&lt;transformer&gt;</code> definitions.
However, if the custom transformer handler implementation should be scoped to a single definition of the <code>&lt;transformer&gt;</code>, you can define an inner bean definition, as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:transformer id=&quot;testTransformer&quot; input-channel=&quot;inChannel&quot; method=&quot;transform&quot;
                output-channel=&quot;outChannel&quot;&gt;
  &lt;beans:bean class=&quot;org.foo.TestTransformer&quot;/&gt;
&lt;/transformer&gt;
</code></pre></div><table><thead><tr><th></th> <th>Using both the <code>ref</code> attribute and an inner handler definition in the same <code>&lt;transformer&gt;</code> configuration is not allowed, as it creates an ambiguous condition and results in an exception being thrown.</th></tr></thead> <tbody></tbody></table> <table><thead><tr><th></th> <th>If the <code>ref</code> attribute references a bean that extends <code>AbstractMessageProducingHandler</code> (such as transformers provided by the framework itself), the configuration is optimized by injecting the output channel into the handler directly.<br>In this case, each <code>ref</code> must be to a separate bean instance (or a <code>prototype</code>-scoped bean) or use the inner <code>&lt;bean/&gt;</code> configuration type.<br>If you inadvertently reference the same message handler from multiple beans, you get a configuration exception.</th></tr></thead> <tbody></tbody></table> <p>When using a POJO, the method that is used for transformation may expect either the <code>Message</code> type or the payload type of inbound messages.
It may also accept message header values either individually or as a full map by using the <code>@Header</code> and <code>@Headers</code> parameter annotations, respectively.
The return value of the method can be any type.
If the return value is itself a <code>Message</code>, that is passed along to the transformer’s output channel.</p> <p>As of Spring Integration 2.0, a message transformer’s transformation method can no longer return <code>null</code>.
Returning <code>null</code> results in an exception, because a message transformer should always be expected to transform each source message into a valid target message.
In other words, a message transformer should not be used as a message filter, because there is a dedicated <code>&lt;filter&gt;</code> option for that.
However, if you do need this type of behavior (where a component might return <code>null</code> and that should not be considered an error), you could use a service activator.
Its <code>requires-reply</code> value is <code>false</code> by default, but that can be set to <code>true</code> in order to have exceptions thrown for <code>null</code> return values, as with the transformer.</p> <h4 id=""><a href="#" class="header-anchor">#</a></h4> <p>Like routers, aggregators, and other components, as of Spring Integration 2.0, transformers can also benefit from <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions" target="_blank" rel="noopener noreferrer">SpEL support<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> whenever transformation logic is relatively simple.
The following example shows how to use a SpEL expression:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:transformer input-channel=&quot;inChannel&quot;
	output-channel=&quot;outChannel&quot;
	expression=&quot;payload.toUpperCase() + '- [' + T(System).currentTimeMillis() + ']'&quot;/&gt;
</code></pre></div><p>The preceding example transforms the payload without writing a custom transformer.
Our payload (assumed to be a <code>String</code>) is upper-cased, concatenated with the current timestamp, and has some formatting applied.</p> <h4 id="common-transformers"><a href="#common-transformers" class="header-anchor">#</a> Common Transformers</h4> <p>Spring Integration provides a few transformer implementations.</p> <h5 id="object-to-string-transformer"><a href="#object-to-string-transformer" class="header-anchor">#</a> Object-to-String Transformer</h5> <p>Because it is fairly common to use the <code>toString()</code> representation of an <code>Object</code>, Spring Integration provides an <code>ObjectToStringTransformer</code> whose output is a <code>Message</code> with a String <code>payload</code>.
That <code>String</code> is the result of invoking the <code>toString()</code> operation on the inbound Message’s payload.
The following example shows how to declare an instance of the object-to-string transformer:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:object-to-string-transformer input-channel=&quot;in&quot; output-channel=&quot;out&quot;/&gt;
</code></pre></div><p>A potential use for this transformer would be sending some arbitrary object to the 'outbound-channel-adapter' in the <code>file</code> namespace.
Whereas that channel adapter only supports <code>String</code>, byte-array, or <code>java.io.File</code> payloads by default, adding this transformer immediately before the adapter handles the necessary conversion.
That works fine as long as the result of the <code>toString()</code> call is what you want to be written to the file.
Otherwise, you can provide a custom POJO-based transformer by using the generic 'transformer' element shown previously.</p> <table><thead><tr><th></th> <th>When debugging, this transformer is not typically necessary, since the <code>logging-channel-adapter</code> is capable of logging the message payload.<br>See <a href="/en/spring-integration/channel.html#channel-wiretap">Wire Tap</a> for more detail.</th></tr></thead> <tbody></tbody></table> <table><thead><tr><th></th> <th>The object-to-string transformer is very simple.<br>It invokes <code>toString()</code> on the inbound payload.<br>Since Spring Integration 3.0, there are two exceptions to this rule:<br><br>* If the payload is a <code>char[]</code>, it invokes <code>new String(payload)</code>.<br><br>* If the payload is a <code>byte[]</code>, it invokes <code>new String(payload, charset)</code>, where <code>charset</code> is UTF-8 by default.<br>  The <code>charset</code> can be modified by supplying the charset attribute on the transformer.<br><br>For more sophistication (such as selection of the charset dynamically, at runtime), you can use a SpEL expression-based transformer instead, as the following example shows:<br><br><code>&lt;br/&gt;&lt;int:transformer input-channel=&quot;in&quot; output-channel=&quot;out&quot;&lt;br/&gt; expression=&quot;new java.lang.String(payload, headers['myCharset']&quot; /&gt;&lt;br/&gt;</code></th></tr></thead> <tbody></tbody></table> <p>If you need to serialize an <code>Object</code> to a byte array or deserialize a byte array back into an <code>Object</code>, Spring Integration provides symmetrical serialization transformers.
These use standard Java serialization by default, but you can provide an implementation of Spring <code>Serializer</code> or <code>Deserializer</code> strategies by using the <code>serializer</code> and <code>deserializer</code> attributes, respectively.
The following example shows to use Spring’s serializer and deserializer:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:payload-serializing-transformer input-channel=&quot;objectsIn&quot; output-channel=&quot;bytesOut&quot;/&gt;

&lt;int:payload-deserializing-transformer input-channel=&quot;bytesIn&quot; output-channel=&quot;objectsOut&quot;
    allow-list=&quot;com.mycom.*,com.yourcom.*&quot;/&gt;
</code></pre></div><table><thead><tr><th></th> <th>When deserializing data from untrusted sources, you should consider adding a <code>allow-list</code> of package and class patterns.<br>By default, all classes are deserialized.</th></tr></thead> <tbody></tbody></table> <h5 id="object-to-map-and-map-to-object-transformers"><a href="#object-to-map-and-map-to-object-transformers" class="header-anchor">#</a> <code>Object</code>-to-<code>Map</code> and <code>Map</code>-to-<code>Object</code> Transformers</h5> <p>Spring Integration also provides <code>Object</code>-to-<code>Map</code> and <code>Map</code>-to-<code>Object</code> transformers, which use the JSON to serialize and de-serialize the object graphs.
The object hierarchy is introspected to the most primitive types (<code>String</code>, <code>int</code>, and so on).
The path to this type is described with SpEL, which becomes the <code>key</code> in the transformed <code>Map</code>.
The primitive type becomes the value.</p> <p>Consider the following example:</p> <div class="language- extra-class"><pre class="language-text"><code>public class Parent{
    private Child child;
    private String name;
    // setters and getters are omitted
}

public class Child{
    private String name;
    private List&lt;String&gt; nickNames;
    // setters and getters are omitted
}
</code></pre></div><p>The two classes in the preceding example are transformed to the following <code>Map</code>:</p> <div class="language- extra-class"><pre class="language-text"><code>{person.name=George, person.child.name=Jenna, person.child.nickNames[0]=Jen ...}
</code></pre></div><p>The JSON-based <code>Map</code> lets you describe the object structure without sharing the actual types, which lets you restore and rebuild the object graph into a differently typed object graph, as long as you maintain the structure.</p> <p>For example, the preceding structure could be restored back to the following object graph by using the <code>Map</code>-to-<code>Object</code> transformer:</p> <div class="language- extra-class"><pre class="language-text"><code>public class Father {
    private Kid child;
    private String name;
    // setters and getters are omitted
}

public class Kid {
    private String name;
    private List&lt;String&gt; nickNames;
    // setters and getters are omitted
}
</code></pre></div><p>If you need to create a “structured” map, you can provide the <code>flatten</code> attribute.
The default is 'true'.
If you set it to 'false', the structure is a <code>Map</code> of <code>Map</code> objects.</p> <p>Consider the following example:</p> <div class="language- extra-class"><pre class="language-text"><code>public class Parent {
	private Child child;
	private String name;
	// setters and getters are omitted
}

public class Child {
	private String name;
	private List&lt;String&gt; nickNames;
	// setters and getters are omitted
}
</code></pre></div><p>The two classes in the preceding example are transformed to the following <code>Map</code>:</p> <div class="language- extra-class"><pre class="language-text"><code>{name=George, child={name=Jenna, nickNames=[Bimbo, ...]}}
</code></pre></div><p>To configure these transformers, Spring Integration provides namespace support for Object-to-Map, as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:object-to-map-transformer input-channel=&quot;directInput&quot; output-channel=&quot;output&quot;/&gt;
</code></pre></div><p>You can also set the <code>flatten</code> attribute to false, as follows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:object-to-map-transformer input-channel=&quot;directInput&quot; output-channel=&quot;output&quot; flatten=&quot;false&quot;/&gt;
</code></pre></div><p>Spring Integration provides namespace support for Map-to-Object, as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:map-to-object-transformer input-channel=&quot;input&quot;
                         output-channel=&quot;output&quot;
                         type=&quot;org.something.Person&quot;/&gt;
</code></pre></div><p>Alterately, you could use a <code>ref</code> attribute and a prototype-scoped bean, as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:map-to-object-transformer input-channel=&quot;inputA&quot;
                               output-channel=&quot;outputA&quot;
                               ref=&quot;person&quot;/&gt;
&lt;bean id=&quot;person&quot; class=&quot;org.something.Person&quot; scope=&quot;prototype&quot;/&gt;
</code></pre></div><table><thead><tr><th></th> <th>The 'ref' and 'type' attributes are mutually exclusive.<br>Also, if you use the 'ref' attribute, you must point to a 'prototype' scoped bean.<br>Otherwise, a <code>BeanCreationException</code> is thrown.</th></tr></thead> <tbody></tbody></table> <p>Starting with version 5.0, you can supply the <code>ObjectToMapTransformer</code> with a customized <code>JsonObjectMapper</code> — for when you need special formats for dates or nulls for empty collections (and other uses).
See <a href="#json-transformers">JSON Transformers</a> for more information about <code>JsonObjectMapper</code> implementations.</p> <h5 id="stream-transformer"><a href="#stream-transformer" class="header-anchor">#</a> Stream Transformer</h5> <p>The <code>StreamTransformer</code> transforms <code>InputStream</code> payloads to a <code>byte[]</code>( or a <code>String</code> if a <code>charset</code> is provided).</p> <p>The following example shows how to use the <code>stream-transformer</code> element in XML:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:stream-transformer input-channel=&quot;directInput&quot; output-channel=&quot;output&quot;/&gt; &lt;!-- byte[] --&gt;

&lt;int:stream-transformer id=&quot;withCharset&quot; charset=&quot;UTF-8&quot;
    input-channel=&quot;charsetChannel&quot; output-channel=&quot;output&quot;/&gt; &lt;!-- String --&gt;
</code></pre></div><p>The following example shows how to use the <code>StreamTransformer</code> class and the <code>@Transformer</code> annotation to configure a stream transformer in Java:</p> <div class="language- extra-class"><pre class="language-text"><code>@Bean
@Transformer(inputChannel = &quot;stream&quot;, outputChannel = &quot;data&quot;)
public StreamTransformer streamToBytes() {
    return new StreamTransformer(); // transforms to byte[]
}

@Bean
@Transformer(inputChannel = &quot;stream&quot;, outputChannel = &quot;data&quot;)
public StreamTransformer streamToString() {
    return new StreamTransformer(&quot;UTF-8&quot;); // transforms to String
}
</code></pre></div><h5 id="json-transformers"><a href="#json-transformers" class="header-anchor">#</a> JSON Transformers</h5> <p>Spring Integration provides Object-to-JSON and JSON-to-Object transformers.
The following pair of examples show how to declare them in XML:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:object-to-json-transformer input-channel=&quot;objectMapperInput&quot;/&gt;
</code></pre></div><div class="language- extra-class"><pre class="language-text"><code>&lt;int:json-to-object-transformer input-channel=&quot;objectMapperInput&quot;
    type=&quot;foo.MyDomainObject&quot;/&gt;
</code></pre></div><p>By default, the transformers in the preceding listing use a vanilla <code>JsonObjectMapper</code>.
It is based on an implementation from the classpath.
You can provide your own custom <code>JsonObjectMapper</code> implementation with appropriate options or based on a required library (such as GSON), as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:json-to-object-transformer input-channel=&quot;objectMapperInput&quot;
    type=&quot;something.MyDomainObject&quot; object-mapper=&quot;customObjectMapper&quot;/&gt;
</code></pre></div><table><thead><tr><th></th> <th>Beginning with version 3.0, the <code>object-mapper</code> attribute references an instance of a new strategy interface: <code>JsonObjectMapper</code>.<br>This abstraction lets multiple implementations of JSON mappers be used.<br>Implementation that wraps <a href="https://github.com/FasterXML" target="_blank" rel="noopener noreferrer">Jackson 2<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> is provided, with the version being detected on the classpath.<br>The class is <code>Jackson2JsonObjectMapper</code>, respectively.</th></tr></thead> <tbody></tbody></table> <p>You may wish to consider using a <code>FactoryBean</code> or a factory method to create the <code>JsonObjectMapper</code> with the required characteristics.
The following example shows how to use such a factory:</p> <div class="language- extra-class"><pre class="language-text"><code>public class ObjectMapperFactory {

    public static Jackson2JsonObjectMapper getMapper() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
        return new Jackson2JsonObjectMapper(mapper);
    }
}
</code></pre></div><p>The following example shows how to do the same thing in XML</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;bean id=&quot;customObjectMapper&quot; class=&quot;something.ObjectMapperFactory&quot;
            factory-method=&quot;getMapper&quot;/&gt;
</code></pre></div><table><thead><tr><th></th> <th>Beginning with version 2.2, the <code>object-to-json-transformer</code> sets the <code>content-type</code> header to <code>application/json</code>, by default, if the input message does not already have that header.<br><br>It you wish to set the <code>content-type</code> header to some other value or explicitly overwrite any existing header with some value (including <code>application/json</code>), use the <code>content-type</code> attribute.<br>If you wish to suppress the setting of the header, set the <code>content-type</code> attribute to an empty string (<code>&quot;&quot;</code>).<br>Doing so results in a message with no <code>content-type</code> header, unless such a header was present on the input message.</th></tr></thead> <tbody></tbody></table> <p>Beginning with version 3.0, the <code>ObjectToJsonTransformer</code> adds headers, reflecting the source type, to the message.
Similarly, the <code>JsonToObjectTransformer</code> can use those type headers when converting the JSON to an object.
These headers are mapped in the AMQP adapters so that they are entirely compatible with the Spring-AMQP <a href="https://docs.spring.io/spring-amqp/api/" target="_blank" rel="noopener noreferrer"><code>JsonMessageConverter</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <p>This enables the following flows to work without any special configuration:</p> <ul><li><p><code>…​→amqp-outbound-adapter---→</code></p></li> <li><p><code>---→amqp-inbound-adapter→json-to-object-transformer→…​</code></p> <p>Where the outbound adapter is configured with a <code>JsonMessageConverter</code> and the inbound adapter uses the default <code>SimpleMessageConverter</code>.</p></li> <li><p><code>…​→object-to-json-transformer→amqp-outbound-adapter---→</code></p></li> <li><p><code>---→amqp-inbound-adapter→…​</code></p> <p>Where the outbound adapter is configured with a <code>SimpleMessageConverter</code> and the inbound adapter uses the default <code>JsonMessageConverter</code>.</p></li> <li><p><code>…​→object-to-json-transformer→amqp-outbound-adapter---→</code></p></li> <li><p><code>---→amqp-inbound-adapter→json-to-object-transformer→</code></p> <p>Where both adapters are configured with a <code>SimpleMessageConverter</code>.</p></li></ul> <table><thead><tr><th></th> <th>When using the headers to determine the type, you should not provide a <code>class</code> attribute, because it takes precedence over the headers.</th></tr></thead> <tbody></tbody></table> <p>In addition to JSON Transformers, Spring Integration provides a built-in <code>#jsonPath</code> SpEL function for use in expressions.
For more information see <a href="/en/spring-integration/spel.html#spel">Spring Expression Language (SpEL)</a>.</p> <p>Since version 3.0, Spring Integration also provides a built-in <code>#xpath</code> SpEL function for use in expressions.
For more information see <a href="/en/spring-integration/xml.html#xpath-spel-function">#xpath SpEL Function</a>.</p> <p>Beginning with version 4.0, the <code>ObjectToJsonTransformer</code> supports the <code>resultType</code> property, to specify the node JSON representation.
The result node tree representation depends on the implementation of the provided <code>JsonObjectMapper</code>.
By default, the <code>ObjectToJsonTransformer</code> uses a <code>Jackson2JsonObjectMapper</code> and delegates the conversion of the object to the node tree to the <code>ObjectMapper#valueToTree</code> method.
The node JSON representation provides efficiency for using the <code>JsonPropertyAccessor</code> when the downstream message flow uses SpEL expressions with access to the properties of the JSON data.
See <a href="/en/spring-integration/spel.html#spel-property-accessors">Property Accessors</a> for more information.</p> <p>Beginning with version 5.1, the <code>resultType</code> can be configured as <code>BYTES</code> to produce a message with the <code>byte[]</code> payload for convenience when working with downstream handlers which operate with this data type.</p> <p>Starting with version 5.2, the <code>JsonToObjectTransformer</code> can be configured with a <code>ResolvableType</code> to support generics during deserialization with the target JSON processor.
Also this component now consults request message headers first for the presence of the <code>JsonHeaders.RESOLVABLE_TYPE</code> or <code>JsonHeaders.TYPE_ID</code> and falls back to the configured type otherwise.
The <code>ObjectToJsonTransformer</code> now also populates a <code>JsonHeaders.RESOLVABLE_TYPE</code> header based on the request message payload for any possible downstream scenarios.</p> <p>Starting with version 5.2.6, the <code>JsonToObjectTransformer</code> can be supplied with a <code>valueTypeExpression</code> to resolve a <code>ResolvableType</code> for the payload to convert from JSON at runtime against the request message.
By default it consults <code>JsonHeaders</code> in the request message.
If this expression returns <code>null</code> or <code>ResolvableType</code> building throws a <code>ClassNotFoundException</code>, the transformer falls back to the provided <code>targetType</code>.
This logic is present as an expression because <code>JsonHeaders</code> may not have real class values, but rather some type ids which have to be mapped to target classes according some external registry.</p> <h5 id="apache-avro-transformers"><a href="#apache-avro-transformers" class="header-anchor">#</a> Apache Avro Transformers</h5> <p>Version 5.2 added simple transformers to transform to/from Apache Avro.</p> <p>They are unsophisticated in that there is no schema registry; the transformers simply use the schema embedded in the <code>SpecificRecord</code> implementation generated from the Avro schema.</p> <p>Messages sent to the <code>SimpleToAvroTransformer</code> must have a payload that implements <code>SpecificRecord</code>; the transformer can handle multiple types.
The <code>SimpleFromAvroTransformer</code> must be configured with a <code>SpecificRecord</code> class which is used as the default type to deserialize.
You can also specify a SpEL expression to determine the type to deserialize using the <code>setTypeExpression</code> method.
The default SpEL expression is <code>headers[avro_type]</code> (<code>AvroHeaders.TYPE</code>) which, by default, is populated by the <code>SimpleToAvroTransformer</code> with the fully qualified class name of the source class.
If the expression returns <code>null</code>, the <code>defaultType</code> is used.</p> <p>The <code>SimpleToAvroTransformer</code> also has a <code>setTypeExpression</code> method.
This allows decoupling of the producer and consumer where the sender can set the header to some token representing the type and the consumer then maps that token to a type.</p> <h4 id="configuring-a-transformer-with-annotations"><a href="#configuring-a-transformer-with-annotations" class="header-anchor">#</a> Configuring a Transformer with Annotations</h4> <p>You can add the <code>@Transformer</code> annotation to methods that expect either the <code>Message</code> type or the message payload type.
The return value is handled in the exact same way as described earlier <a href="#transformer-namespace">in the section describing the <code>&lt;transformer&gt;</code> element</a>.
The following example shows how to use the <code>@Transformer</code> annotation to transform a <code>String</code> into an <code>Order</code>:</p> <div class="language- extra-class"><pre class="language-text"><code>@Transformer
Order generateOrder(String productId) {
    return new Order(productId);
}
</code></pre></div><p>Transformer methods can also accept the <code>@Header</code> and <code>@Headers</code> annotations, as documented in <code>[Annotation Support](./configuration.html#annotations)</code>.
The following examples shows how to use the <code>@Header</code> annotation:</p> <div class="language- extra-class"><pre class="language-text"><code>@Transformer
Order generateOrder(String productId, @Header(&quot;customerName&quot;) String customer) {
    return new Order(productId, customer);
}
</code></pre></div><p>See also <a href="/en/spring-integration/handler-advice.html#advising-with-annotations">Advising Endpoints Using Annotations</a>.</p> <h4 id="header-filter"><a href="#header-filter" class="header-anchor">#</a> Header Filter</h4> <p>Sometimes, your transformation use case might be as simple as removing a few headers.
For such a use case, Spring Integration provides a header filter that lets you specify certain header names that should be removed from the output message (for example, removing headers for security reasons or a value that was needed only temporarily).
Basically, the header filter is the opposite of the header enricher.
The latter is discussed in <a href="/en/spring-integration/content-enrichment.html#header-enricher">Header Enricher</a>.
The following example defines a header filter:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-filter input-channel=&quot;inputChannel&quot;
		output-channel=&quot;outputChannel&quot; header-names=&quot;lastName, state&quot;/&gt;
</code></pre></div><p>As you can see, configuration of a header filter is quite simple.
It is a typical endpoint with input and output channels and a <code>header-names</code> attribute.
That attribute accepts the names of the headers (delimited by commas if there are multiple) that need to be removed.
So, in the preceding example, the headers named 'lastName' and 'state' are not present on the outbound message.</p> <h4 id="codec-based-transformers"><a href="#codec-based-transformers" class="header-anchor">#</a> Codec-Based Transformers</h4> <p>See <a href="/en/spring-integration/codec.html#codec">Codec</a>.</p> <h3 id="content-enricher"><a href="#content-enricher" class="header-anchor">#</a> Content Enricher</h3> <p>At times, you may have a requirement to enhance a request with more information than was provided by the target system.
The <a href="https://www.enterpriseintegrationpatterns.com/DataEnricher.html" target="_blank" rel="noopener noreferrer">data enricher<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> pattern describes various scenarios as well as the component (Enricher) that lets you address such requirements.</p> <p>The Spring Integration <code>Core</code> module includes two enrichers:</p> <ul><li><p><a href="#header-enricher">Header Enricher</a></p></li> <li><p><a href="#payload-enricher">Payload Enricher</a></p></li></ul> <p>It also includes three adapter-specific header enrichers:</p> <ul><li><p><a href="/en/spring-integration/xml.html#xml-xpath-header-enricher">XPath Header Enricher (XML Module)</a></p></li> <li><p><a href="/en/spring-integration/mail.html#mail-namespace">Mail Header Enricher (Mail Module)</a></p></li> <li><p><a href="/en/spring-integration/xmpp.html#xmpp-message-outbound-channel-adapter">XMPP Header Enricher (XMPP Module)</a></p></li></ul> <p>See the adapter-specific sections of this reference manual to learn more about those adapters.</p> <p>For more information regarding expressions support, see <a href="/en/spring-integration/spel.html#spel">Spring Expression Language (SpEL)</a>.</p> <h4 id="header-enricher"><a href="#header-enricher" class="header-anchor">#</a> Header Enricher</h4> <p>If you need do nothing more than add headers to a message and the headers are not dynamically determined by the message content, referencing a custom implementation of a transformer may be overkill.
For that reason, Spring Integration provides support for the header enricher pattern.
It is exposed through the <code>&lt;header-enricher&gt;</code> element.
The following example shows how to use it:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-enricher input-channel=&quot;in&quot; output-channel=&quot;out&quot;&gt;
    &lt;int:header name=&quot;foo&quot; value=&quot;123&quot;/&gt;
    &lt;int:header name=&quot;bar&quot; ref=&quot;someBean&quot;/&gt;
&lt;/int:header-enricher&gt;
</code></pre></div><p>The header enricher also provides helpful sub-elements to set well known header names, as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-enricher input-channel=&quot;in&quot; output-channel=&quot;out&quot;&gt;
    &lt;int:error-channel ref=&quot;applicationErrorChannel&quot;/&gt;
    &lt;int:reply-channel ref=&quot;quoteReplyChannel&quot;/&gt;
    &lt;int:correlation-id value=&quot;123&quot;/&gt;
    &lt;int:priority value=&quot;HIGHEST&quot;/&gt;
    &lt;routing-slip value=&quot;channel1; routingSlipRoutingStrategy; request.headers[myRoutingSlipChannel]&quot;/&gt;
    &lt;int:header name=&quot;bar&quot; ref=&quot;someBean&quot;/&gt;
&lt;/int:header-enricher&gt;
</code></pre></div><p>The preceding configuration shows that, for well known headers (such as <code>errorChannel</code>, <code>correlationId</code>, <code>priority</code>, <code>replyChannel</code>, <code>routing-slip</code>, and others), instead of using generic <code>&lt;header&gt;</code> sub-elements where you would have to provide both header 'name' and 'value', you can use convenient sub-elements to set those values directly.</p> <p>Starting with version 4.1, the header enricher provides a <code>routing-slip</code> sub-element.
See <a href="/en/spring-integration/router.html#routing-slip">Routing Slip</a> for more information.</p> <h5 id="pojo-support"><a href="#pojo-support" class="header-anchor">#</a> POJO Support</h5> <p>Often, a header value cannot be defined statically and has to be determined dynamically based on some content in the message.
That is why the header enricher lets you also specify a bean reference by using the <code>ref</code> and <code>method</code> attributes.
The specified method calculates the header value.
Consider the following configuration and a bean with a method that modifies a <code>String</code>:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-enricher input-channel=&quot;in&quot; output-channel=&quot;out&quot;&gt;
    &lt;int:header name=&quot;something&quot; method=&quot;computeValue&quot; ref=&quot;myBean&quot;/&gt;
&lt;/int:header-enricher&gt;

&lt;bean id=&quot;myBean&quot; class=&quot;thing1.thing2.MyBean&quot;/&gt;
</code></pre></div><div class="language- extra-class"><pre class="language-text"><code>public class MyBean {

    public String computeValue(String payload){
        return payload.toUpperCase() + &quot;_US&quot;;
    }
}
</code></pre></div><p>You can also configure your POJO as an inner bean, as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-enricher  input-channel=&quot;inputChannel&quot; output-channel=&quot;outputChannel&quot;&gt;
    &lt;int:header name=&quot;some_header&quot;&gt;
        &lt;bean class=&quot;org.MyEnricher&quot;/&gt;
    &lt;/int:header&gt;
&lt;/int:header-enricher&gt;
</code></pre></div><p>You can similarly point to a Groovy script, as the following example shows:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-enricher  input-channel=&quot;inputChannel&quot; output-channel=&quot;outputChannel&quot;&gt;
    &lt;int:header name=&quot;some_header&quot;&gt;
        &lt;int-groovy:script location=&quot;org/SampleGroovyHeaderEnricher.groovy&quot;/&gt;
    &lt;/int:header&gt;
&lt;/int:header-enricher&gt;
</code></pre></div><h5 id="spel-support"><a href="#spel-support" class="header-anchor">#</a> SpEL Support</h5> <p>In Spring Integration 2.0, we introduced the convenience of the <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions" target="_blank" rel="noopener noreferrer">Spring Expression Language (SpEL)<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> to help configure many different components.
The header enricher is one of them.
Look again at the POJO example shown earlier.
You can see that the computation logic to determine the header value is pretty simple.
A natural question would be: &quot;Is there an even simpler way to accomplish this?&quot;.
That is where SpEL shows its true power.
Consider the following example:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-enricher input-channel=&quot;in&quot; output-channel=&quot;out&quot;&gt;
    &lt;int:header name=&quot;foo&quot; expression=&quot;payload.toUpperCase() + '_US'&quot;/&gt;
&lt;/int:header-enricher&gt;
</code></pre></div><p>By using SpEL for such simple cases, you no longer have to provide a separate class and configure it in the application context.
All you need do is configured the <code>expression</code> attribute with a valid SpEL expression.
The 'payload' and 'headers' variables are bound to the SpEL evaluation context, giving you full access to the incoming message.</p> <h5 id="configuring-a-header-enricher-with-java-configuration"><a href="#configuring-a-header-enricher-with-java-configuration" class="header-anchor">#</a> Configuring a Header Enricher with Java Configuration</h5> <p>The following two examples show how to use Java Configuration for header enrichers:</p> <div class="language- extra-class"><pre class="language-text"><code>@Bean
@Transformer(inputChannel = &quot;enrichHeadersChannel&quot;, outputChannel = &quot;emailChannel&quot;)
public HeaderEnricher enrichHeaders() {
    Map&lt;String, ? extends HeaderValueMessageProcessor&lt;?&gt;&gt; headersToAdd =
            Collections.singletonMap(&quot;emailUrl&quot;,
                      new StaticHeaderValueMessageProcessor&lt;&gt;(this.imapUrl));
    HeaderEnricher enricher = new HeaderEnricher(headersToAdd);
    return enricher;
}

@Bean
@Transformer(inputChannel=&quot;enrichHeadersChannel&quot;, outputChannel=&quot;emailChannel&quot;)
public HeaderEnricher enrichHeaders() {
    Map&lt;String, HeaderValueMessageProcessor&lt;?&gt;&gt; headersToAdd = new HashMap&lt;&gt;();
    headersToAdd.put(&quot;emailUrl&quot;, new StaticHeaderValueMessageProcessor&lt;String&gt;(this.imapUrl));
    Expression expression = new SpelExpressionParser().parseExpression(&quot;payload.from[0].toString()&quot;);
    headersToAdd.put(&quot;from&quot;,
               new ExpressionEvaluatingHeaderValueMessageProcessor&lt;&gt;(expression, String.class));
    HeaderEnricher enricher = new HeaderEnricher(headersToAdd);
    return enricher;
}
</code></pre></div><p>The first example adds a single literal header.
The second example adds two headers, a literal header and one based on a SpEL expression.</p> <h5 id="configuring-a-header-enricher-with-the-java-dsl"><a href="#configuring-a-header-enricher-with-the-java-dsl" class="header-anchor">#</a> Configuring a Header Enricher with the Java DSL</h5> <p>The following example shows Java DSL Configuration for a header enricher:</p> <div class="language- extra-class"><pre class="language-text"><code>@Bean
public IntegrationFlow enrichHeadersInFlow() {
    return f -&gt; f
                ...
                .enrichHeaders(h -&gt; h.header(&quot;emailUrl&quot;, this.emailUrl)
                                     .headerExpression(&quot;from&quot;, &quot;payload.from[0].toString()&quot;))
                .handle(...);
}
</code></pre></div><h5 id="header-channel-registry"><a href="#header-channel-registry" class="header-anchor">#</a> Header Channel Registry</h5> <p>Starting with Spring Integration 3.0, a new sub-element <code>&lt;int:header-channels-to-string/&gt;</code> is available.
It has no attributes.
This new sub-element converts existing <code>replyChannel</code> and <code>errorChannel</code> headers (when they are a <code>MessageChannel</code>) to a <code>String</code> and stores the channels in a registry for later resolution, when it is time to send a reply or handle an error.
This is useful for cases where the headers might be lost — for example, when serializing a message into a message store or when transporting the message over JMS.
If the header does not already exist or it is not a <code>MessageChannel</code>, no changes are made.</p> <p>Using this functionality requires the presence of a <code>HeaderChannelRegistry</code> bean.
By default, the framework creates a <code>DefaultHeaderChannelRegistry</code> with the default expiry (60 seconds).
Channels are removed from the registry after this time.
To change this behavior, define a bean with an <code>id</code> of <code>integrationHeaderChannelRegistry</code> and configure the required default delay by using a constructor argument (in milliseconds).</p> <p>Since version 4.1, you can set a property called <code>removeOnGet</code> to <code>true</code> on the <code>&lt;bean/&gt;</code> definition, and the mapping entry is removed immediately on first use.
This might be useful in a high-volume environment and when the channel is only used once, rather than waiting for the reaper to remove it.</p> <p>The <code>HeaderChannelRegistry</code> has a <code>size()</code> method to determine the current size of the registry.
The <code>runReaper()</code> method cancels the current scheduled task and runs the reaper immediately.
The task is then scheduled to run again based on the current delay.
These methods can be invoked directly by getting a reference to the registry, or you can send a message with, for example, the following content to a control bus:</p> <div class="language- extra-class"><pre class="language-text"><code>&quot;@integrationHeaderChannelRegistry.runReaper()&quot;
</code></pre></div><p>This sub-element is a convenience, and is the equivalent of specifying the following configuration:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:reply-channel
    expression=&quot;@integrationHeaderChannelRegistry.channelToChannelName(headers.replyChannel)&quot;
    overwrite=&quot;true&quot; /&gt;
&lt;int:error-channel
    expression=&quot;@integrationHeaderChannelRegistry.channelToChannelName(headers.errorChannel)&quot;
    overwrite=&quot;true&quot; /&gt;
</code></pre></div><p>Starting with version 4.1, you can now override the registry’s configured reaper delay so that the channel mapping is retained for at least the specified time, regardless of the reaper delay.
The following example shows how to do so:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:header-enricher input-channel=&quot;inputTtl&quot; output-channel=&quot;next&quot;&gt;
    &lt;int:header-channels-to-string time-to-live-expression=&quot;120000&quot; /&gt;
&lt;/int:header-enricher&gt;

&lt;int:header-enricher input-channel=&quot;inputCustomTtl&quot; output-channel=&quot;next&quot;&gt;
    &lt;int:header-channels-to-string
        time-to-live-expression=&quot;headers['channelTTL'] ?: 120000&quot; /&gt;
&lt;/int:header-enricher&gt;
</code></pre></div><p>In the first case, the time to live for every header channel mapping will be two minutes.
In the second case, the time to live is specified in the message header and uses an Elvis operator to use two minutes if there is no header.</p> <h4 id="payload-enricher"><a href="#payload-enricher" class="header-anchor">#</a> Payload Enricher</h4> <p>In certain situations, the header enricher, as discussed earlier, may not be sufficient and payloads themselves may have to be enriched with additional information.
For example, order messages that enter the Spring Integration messaging system have to look up the order’s customer based on the provided customer number and then enrich the original payload with that information.</p> <p>Spring Integration 2.1 introduced the payload enricher.
The payload enricher defines an endpoint that passes a <code>Message</code> to the exposed request channel and then expects a reply message.
The reply message then becomes the root object for evaluation of expressions to enrich the target payload.</p> <p>The payload enricher provides full XML namespace support through the <code>enricher</code> element.
In order to send request messages, the payload enricher has a <code>request-channel</code> attribute that lets you dispatch messages to a request channel.</p> <p>Basically, by defining the request channel, the payload enricher acts as a gateway, waiting for the message sent to the request channel to return.
The enricher then augments the message’s payload with the data provided by the reply message.</p> <p>When sending messages to the request channel, you also have the option to send only a subset of the original payload by using the <code>request-payload-expression</code> attribute.</p> <p>The enriching of payloads is configured through SpEL expressions, providing a maximum degree of flexibility.
Therefore, you can not only enrich payloads with direct values from the reply channel’s <code>Message</code>, but you can use SpEL expressions to extract a subset from that message or to apply additional inline transformations, letting you further manipulate the data.</p> <p>If you need only to enrich payloads with static values, you need not provide the <code>request-channel</code> attribute.</p> <table><thead><tr><th></th> <th>Enrichers are a variant of transformers.<br>In many cases, you could use a payload enricher or a generic transformer implementation to add additional data to your message payloads.<br>You should familiarize yourself with all transformation-capable components that are provided by Spring Integration and carefully select the implementation that semantically fits your business case best.</th></tr></thead> <tbody></tbody></table> <h5 id="configuration"><a href="#configuration" class="header-anchor">#</a> Configuration</h5> <p>The following example shows all available configuration options for the payload enricher:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:enricher request-channel=&quot;&quot;                           (1)
              auto-startup=&quot;true&quot;                          (2)
              id=&quot;&quot;                                        (3)
              order=&quot;&quot;                                     (4)
              output-channel=&quot;&quot;                            (5)
              request-payload-expression=&quot;&quot;                (6)
              reply-channel=&quot;&quot;                             (7)
              error-channel=&quot;&quot;                             (8)
              send-timeout=&quot;&quot;                              (9)
              should-clone-payload=&quot;false&quot;&gt;                (10)
    &lt;int:poller&gt;&lt;/int:poller&gt;                              (11)
    &lt;int:property name=&quot;&quot; expression=&quot;&quot; null-result-expression=&quot;'Could not determine the name'&quot;/&gt;   (12)
    &lt;int:property name=&quot;&quot; value=&quot;23&quot; type=&quot;java.lang.Integer&quot; null-result-expression=&quot;'0'&quot;/&gt;
    &lt;int:header name=&quot;&quot; expression=&quot;&quot; null-result-expression=&quot;&quot;/&gt;   (13)
    &lt;int:header name=&quot;&quot; value=&quot;&quot; overwrite=&quot;&quot; type=&quot;&quot; null-result-expression=&quot;&quot;/&gt;
&lt;/int:enricher&gt;
</code></pre></div><table><thead><tr><th><strong>1</strong></th> <th>Channel to which a message is sent to get the data to use for enrichment.<br>Optional.</th></tr></thead> <tbody><tr><td><strong>2</strong></td> <td>Lifecycle attribute signaling whether this component should be started during the application context startup.<br>Defaults to true.<br>Optional.</td></tr> <tr><td><strong>3</strong></td> <td>ID of the underlying bean definition, which is either an <code>EventDrivenConsumer</code> or a <code>PollingConsumer</code>.<br>Optional.</td></tr> <tr><td><strong>4</strong></td> <td>Specifies the order for invocation when this endpoint is connected as a subscriber to a channel.<br>This is particularly relevant when that channel is using a “failover” dispatching strategy.<br>It has no effect when this endpoint is itself a polling consumer for a channel with a queue.<br>Optional.</td></tr> <tr><td><strong>5</strong></td> <td>Identifies the message channel where a message is sent after it is being processed by this endpoint.<br>Optional.</td></tr> <tr><td><strong>6</strong></td> <td>By default, the original message’s payload is used as payload that is sent to the <code>request-channel</code>.<br>By specifying a SpEL expression as the value for the <code>request-payload-expression</code> attribute, you can use a subset of the original payload, a header value, or any other resolvable SpEL expression as the basis for the payload that is sent to the request-channel.<br>For the expression evaluation, the full message is available as the 'root object'.<br>For instance, the following SpEL expressions (among others) are possible: <code>payload.something</code>, <code>headers.something</code>, <code>new java.util.Date()</code>, <code>'thing1' + 'thing2'</code></td></tr> <tr><td><strong>7</strong></td> <td>Channel where a reply message is expected.<br>This is optional.<br>Typically, the auto-generated temporary reply channel suffices.<br>Optional.</td></tr> <tr><td><strong>8</strong></td> <td>The channel to which an <code>ErrorMessage</code> is sent if an <code>Exception</code> occurs downstream of the <code>request-channel</code>.<br>This enables you to return an alternative object to use for enrichment.<br>If it is not set, an <code>Exception</code> is thrown to the caller.<br>Optional.</td></tr> <tr><td><strong>9</strong></td> <td>Maximum amount of time in milliseconds to wait when sending a message to the channel, if the channel might block.<br>For example, a queue channel can block until space is available, if its maximum capacity has been reached.<br>Internally, the send timeout is set on the <code>MessagingTemplate</code> and ultimately applied when invoking the send operation on the <code>MessageChannel</code>.<br>By default, the send timeout is set to '-1', which can cause the send operation on the <code>MessageChannel</code>, depending on the implementation, to block indefinitely.<br>Optional.</td></tr> <tr><td><strong>10</strong></td> <td>Boolean value indicating whether any payload that implements <code>Cloneable</code> should be cloned prior to sending the message to the request channel for acquiring the enriching data.<br>The cloned version would be used as the target payload for the ultimate reply.<br>The default is <code>false</code>.<br>Optional.</td></tr> <tr><td><strong>11</strong></td> <td>Lets you configure a message poller if this endpoint is a polling consumer.<br>Optional.</td></tr> <tr><td><strong>12</strong></td> <td>Each <code>property</code> sub-element provides the name of a property (through the mandatory <code>name</code> attribute).<br>That property should be settable on the target payload instance.<br>Exactly one of the <code>value</code> or <code>expression</code> attributes must be provided as well — the former for a literal value to set and the latter for a SpEL expression to be evaluated.<br>The root object of the evaluation context is the message that was returned from the flow initiated by this enricher — the input message if there is no request channel or the application context (using the <code>@&lt;beanName&gt;.&lt;beanProperty&gt;</code> SpEL syntax).<br>Starting with version 4.0, when specifying a <code>value</code> attribute, you can also specify an optional <code>type</code> attribute.<br>When the destination is a typed setter method, the framework coerces the value appropriately (as long as a <code>PropertyEditor</code>) exists to handle the conversion.<br>If, however, the target payload is a <code>Map</code>, the entry is populated with the value without conversion.<br>The <code>type</code> attribute lets you, for example, convert a <code>String</code> containing a number to an <code>Integer</code> value in the target payload.<br>Starting with version 4.1, you can also specify an optional <code>null-result-expression</code> attribute.<br>When the <code>enricher</code> returns null, it is evaluated, and the output of the evaluation is returned instead.</td></tr> <tr><td><strong>13</strong></td> <td>Each <code>header</code> sub-element provides the name of a message header (through the mandatory <code>name</code> attribute).<br>Exactly one of the <code>value</code> or <code>expression</code> attributes must also be provided — the former for a literal value to set and the latter for a SpEL expression to be evaluated.<br>The root object of the evaluation context is the message that was returned from the flow initiated by this enricher — the input message if there is no request channel or the application context (using the '@&lt;beanName&gt;.&lt;beanProperty&gt;' SpEL syntax).<br>Note that, similarly to the <code>&lt;header-enricher&gt;</code>, the <code>&lt;enricher&gt;</code> element’s <code>header</code> element has <code>type</code> and <code>overwrite</code> attributes.<br>However, a key difference is that, with the <code>&lt;enricher&gt;</code>, the <code>overwrite</code> attribute is <code>true</code> by default, to be consistent with the <code>&lt;enricher&gt;</code> element’s <code>&lt;property&gt;</code> sub-element.<br>Starting with version 4.1, you can also specify an optional <code>null-result-expression</code> attribute.<br>When the <code>enricher</code> returns null, it is evaluated, and the output of the evaluation is returned instead.</td></tr></tbody></table> <h5 id="examples"><a href="#examples" class="header-anchor">#</a> Examples</h5> <p>This section contains several examples of using a payload enricher in various situations.</p> <table><thead><tr><th></th> <th>The code samples shown here are part of the Spring Integration Samples project.<br>See <a href="/en/spring-integration/samples.html#samples">Spring Integration Samples</a>.</th></tr></thead> <tbody></tbody></table> <p>In the following example, a <code>User</code> object is passed as the payload of the <code>Message</code>:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:enricher id=&quot;findUserEnricher&quot;
              input-channel=&quot;findUserEnricherChannel&quot;
              request-channel=&quot;findUserServiceChannel&quot;&gt;
    &lt;int:property name=&quot;email&quot;    expression=&quot;payload.email&quot;/&gt;
    &lt;int:property name=&quot;password&quot; expression=&quot;payload.password&quot;/&gt;
&lt;/int:enricher&gt;
</code></pre></div><p>The <code>User</code> has several properties, but only the <code>username</code> is set initially.
The enricher’s <code>request-channel</code> attribute is configured to pass the <code>User</code> to the <code>findUserServiceChannel</code>.</p> <p>Through the implicitly set <code>reply-channel</code>, a <code>User</code> object is returned and, by using the <code>property</code> sub-element, properties from the reply are extracted and used to enrich the original payload.</p> <h5 id="how-do-i-pass-only-a-subset-of-data-to-the-request-channel"><a href="#how-do-i-pass-only-a-subset-of-data-to-the-request-channel" class="header-anchor">#</a> How Do I Pass Only a Subset of Data to the Request Channel?</h5> <p>When using a <code>request-payload-expression</code> attribute, a single property of the payload instead of the full message can be passed on to the request channel.
In the following example, the username property is passed on to the request channel:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:enricher id=&quot;findUserByUsernameEnricher&quot;
              input-channel=&quot;findUserByUsernameEnricherChannel&quot;
              request-channel=&quot;findUserByUsernameServiceChannel&quot;
              request-payload-expression=&quot;payload.username&quot;&gt;
    &lt;int:property name=&quot;email&quot;    expression=&quot;payload.email&quot;/&gt;
    &lt;int:property name=&quot;password&quot; expression=&quot;payload.password&quot;/&gt;
&lt;/int:enricher&gt;
</code></pre></div><p>Keep in mind that, although only the username is passed, the resulting message to the request channel contains the full set of <code>MessageHeaders</code>.</p> <h6 id="how-can-i-enrich-payloads-that-consist-of-collection-data"><a href="#how-can-i-enrich-payloads-that-consist-of-collection-data" class="header-anchor">#</a> How Can I Enrich Payloads that Consist of Collection Data?</h6> <p>In the following example, instead of a <code>User</code> object, a <code>Map</code> is passed in:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:enricher id=&quot;findUserWithMapEnricher&quot;
              input-channel=&quot;findUserWithMapEnricherChannel&quot;
              request-channel=&quot;findUserByUsernameServiceChannel&quot;
              request-payload-expression=&quot;payload.username&quot;&gt;
    &lt;int:property name=&quot;user&quot; expression=&quot;payload&quot;/&gt;
&lt;/int:enricher&gt;
</code></pre></div><p>The <code>Map</code> contains the username under the <code>username</code> map key.
Only the <code>username</code> is passed on to the request channel.
The reply contains a full <code>User</code> object, which is ultimately added to the <code>Map</code> under the <code>user</code> key.</p> <h5 id="how-can-i-enrich-payloads-with-static-information-without-using-a-request-channel"><a href="#how-can-i-enrich-payloads-with-static-information-without-using-a-request-channel" class="header-anchor">#</a> How Can I Enrich Payloads with Static Information without Using a Request Channel?</h5> <p>The following example does not use a request channel at all but solely enriches the message’s payload with static values:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:enricher id=&quot;userEnricher&quot;
              input-channel=&quot;input&quot;&gt;
    &lt;int:property name=&quot;user.updateDate&quot; expression=&quot;new java.util.Date()&quot;/&gt;
    &lt;int:property name=&quot;user.firstName&quot; value=&quot;William&quot;/&gt;
    &lt;int:property name=&quot;user.lastName&quot;  value=&quot;Shakespeare&quot;/&gt;
    &lt;int:property name=&quot;user.age&quot;       value=&quot;42&quot;/&gt;
&lt;/int:enricher&gt;
</code></pre></div><p>Note that the word, 'static', is used loosely here.
You can still use SpEL expressions for setting those values.</p> <h3 id="claim-check"><a href="#claim-check" class="header-anchor">#</a> Claim Check</h3> <p>In earlier sections, we covered several content enricher components that can help you deal with situations where a message is missing a piece of data.
We also discussed content filtering, which lets you remove data items from a message.
However, there are times when we want to hide data temporarily.
For example, in a distributed system, we may receive a message with a very large payload.
Some intermittent message processing steps may not need access to this payload and some may only need to access certain headers, so carrying the large message payload through each processing step may cause performance degradation, may produce a security risk, and may make debugging more difficult.</p> <p>The <a href="https://www.enterpriseintegrationpatterns.com/StoreInLibrary.html" target="_blank" rel="noopener noreferrer">store in library<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> (or claim check) pattern describes a mechanism that lets you store data in a well known place while maintaining only a pointer (a claim check) to where that data is located.
You can pass that pointer around as the payload of a new message, thereby letting any component within the message flow get the actual data as soon as it needs it.
This approach is very similar to the certified mail process, where you get a claim check in your mailbox and then have to go to the post office to claim your actual package.
It is also the same idea as baggage claim after a flight or in a hotel.</p> <p>Spring Integration provides two types of claim check transformers:</p> <ul><li><p>Incoming Claim Check Transformer</p></li> <li><p>Outgoing Claim Check Transformer</p></li></ul> <p>Convenient namespace-based mechanisms are available to configure them.</p> <h4 id="incoming-claim-check-transformer"><a href="#incoming-claim-check-transformer" class="header-anchor">#</a> Incoming Claim Check Transformer</h4> <p>An incoming claim check transformer transforms an incoming message by storing it in the message store identified by its <code>message-store</code> attribute.
The following example defines an incoming claim check transformer:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:claim-check-in id=&quot;checkin&quot;
        input-channel=&quot;checkinChannel&quot;
        message-store=&quot;testMessageStore&quot;
        output-channel=&quot;output&quot;/&gt;
</code></pre></div><p>In the preceding configuration, the message that is received on the <code>input-channel</code> is persisted to the message store identified with the <code>message-store</code> attribute and indexed with a generated ID.
That ID is the claim check for that message.
The claim check also becomes the payload of the new (transformed) message that is sent to the <code>output-channel</code>.</p> <p>Now, assume that at some point you do need access to the actual message.
You can access the message store manually and get the contents of the message, or you can use the same approach (creating a transformer) except that now you transform the Claim Check to the actual message by using an outgoing claim check transformer.</p> <p>The following listing provides an overview of all available parameters of an incoming claim check transformer:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:claim-check-in auto-startup=&quot;true&quot;             (1)
                    id=&quot;&quot;                           (2)
                    input-channel=&quot;&quot;                (3)
                    message-store=&quot;messageStore&quot;    (4)
                    order=&quot;&quot;                        (5)
                    output-channel=&quot;&quot;               (6)
                    send-timeout=&quot;&quot;&gt;                (7)
    &lt;int:poller&gt;&lt;/int:poller&gt;                       (8)
&lt;/int:claim-check-in&gt;
</code></pre></div><table><thead><tr><th><strong>1</strong></th> <th>Lifecycle attribute signaling whether this component should be started during application context startup.<br>It defaults to <code>true</code>.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</th></tr></thead> <tbody><tr><td><strong>2</strong></td> <td>ID identifying the underlying bean definition (<code>MessageTransformingHandler</code>).<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>3</strong></td> <td>The receiving message channel of this endpoint.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>4</strong></td> <td>Reference to the <code>MessageStore</code> to be used by this claim check transformer.<br>If not specified, the default reference is to a bean named <code>messageStore</code>.<br>Optional.</td></tr> <tr><td><strong>5</strong></td> <td>Specifies the order for invocation when this endpoint is connected as a subscriber to a channel.<br>This is particularly relevant when that channel uses a <code>failover</code> dispatching strategy.<br>It has no effect when this endpoint is itself a polling consumer for a channel with a queue.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>6</strong></td> <td>Identifies the message channel where the message is sent after being processed by this endpoint.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>7</strong></td> <td>Specifies the maximum amount of time (in milliseconds) to wait when sending a reply message to the output channel.<br>Defaults to <code>-1</code> — blocking indefinitely.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>8</strong></td> <td>Defines a poller.<br>This element is not available inside a <code>Chain</code> element.<br>Optional.</td></tr></tbody></table> <h4 id="outgoing-claim-check-transformer"><a href="#outgoing-claim-check-transformer" class="header-anchor">#</a> Outgoing Claim Check Transformer</h4> <p>An outgoing claim check transformer lets you transform a message with a claim check payload into a message with the original content as its payload.</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:claim-check-out id=&quot;checkout&quot;
        input-channel=&quot;checkoutChannel&quot;
        message-store=&quot;testMessageStore&quot;
        output-channel=&quot;output&quot;/&gt;
</code></pre></div><p>In the preceding configuration, the message received on the <code>input-channel</code> should have a claim check as its payload.
The outgoing claim check transformer transforms it into a message with the original payload by querying the message store for a message identified by the provided claim check.
It then sends the newly checked-out message to the <code>output-channel</code>.</p> <p>The following listing provides an overview of all available parameters of an outgoing claim check transformer:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:claim-check-out auto-startup=&quot;true&quot;             (1)
                     id=&quot;&quot;                           (2)
                     input-channel=&quot;&quot;                (3)
                     message-store=&quot;messageStore&quot;    (4)
                     order=&quot;&quot;                        (5)
                     output-channel=&quot;&quot;               (6)
                     remove-message=&quot;false&quot;          (7)
                     send-timeout=&quot;&quot;&gt;                (8)
    &lt;int:poller&gt;&lt;/int:poller&gt;                        (9)
&lt;/int:claim-check-out&gt;
</code></pre></div><table><thead><tr><th><strong>1</strong></th> <th>Lifecycle attribute signaling whether this component should be started during application context startup.<br>It defaults to <code>true</code>.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</th></tr></thead> <tbody><tr><td><strong>2</strong></td> <td>ID identifying the underlying bean definition (<code>MessageTransformingHandler</code>).<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>3</strong></td> <td>The receiving message channel of this endpoint.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>4</strong></td> <td>Reference to the <code>MessageStore</code> to be used by this claim check transformer.<br>If not specified, the default reference is to a bean named <code>messageStore</code>.<br>Optional.</td></tr> <tr><td><strong>5</strong></td> <td>Specifies the order for invocation when this endpoint is connected as a subscriber to a channel.<br>This is particularly relevant when that channel is using a <code>failover</code> dispatching strategy.<br>It has no effect when this endpoint is itself a polling consumer for a channel with a queue.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>6</strong></td> <td>Identifies the message channel where the message is sent after being processed by this endpoint.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>7</strong></td> <td>If set to <code>true</code>, the message is removed from the <code>MessageStore</code> by this transformer.<br>This setting is useful when Message can be “claimed” only once.<br>It defaults to <code>false</code>.<br>Optional.</td></tr> <tr><td><strong>8</strong></td> <td>Specifies the maximum amount of time (in milliseconds) to wait when sending a reply message to the output channel.<br>It defaults to <code>-1</code> — blocking indefinitely.<br>This attribute is not available inside a <code>Chain</code> element.<br>Optional.</td></tr> <tr><td><strong>9</strong></td> <td>Defines a poller.<br>This element is not available inside a <code>Chain</code> element.<br>Optional.</td></tr></tbody></table> <h4 id="claim-once"><a href="#claim-once" class="header-anchor">#</a> Claim Once</h4> <p>Sometimes, a particular message must be claimed only once.
As an analogy, consider process of handling airplane luggage.
You checking in your luggage on departure and claiming it on arrival.
Once the luggage has been claimed, it can not be claimed again without first checking it back in.
To accommodate such cases, we introduced a <code>remove-message</code> boolean attribute on the <code>claim-check-out</code> transformer.
This attribute is set to <code>false</code> by default.
However, if set to <code>true</code>, the claimed message is removed from the <code>MessageStore</code> so that it cannot be claimed again.</p> <p>This feature has an impact in terms of storage space, especially in the case of the in-memory <code>Map</code>-based <code>SimpleMessageStore</code>, where failing to remove messages could ultimately lead to an <code>OutOfMemoryException</code>.
Therefore, if you do not expect multiple claims to be made, we recommend that you set the <code>remove-message</code> attribute’s value to <code>true</code>.
The following example show how to use the <code>remove-message</code> attribute:</p> <div class="language- extra-class"><pre class="language-text"><code>&lt;int:claim-check-out id=&quot;checkout&quot;
        input-channel=&quot;checkoutChannel&quot;
        message-store=&quot;testMessageStore&quot;
        output-channel=&quot;output&quot;
        remove-message=&quot;true&quot;/&gt;
</code></pre></div><h4 id="a-word-on-message-store"><a href="#a-word-on-message-store" class="header-anchor">#</a> A Word on Message Store</h4> <p>Although we rarely care about the details of the claim checks (as long as they work), you should know that the current implementation of the actual claim check (the pointer) in Spring Integration uses a UUID to ensure uniqueness.</p> <p><code>org.springframework.integration.store.MessageStore</code> is a strategy interface for storing and retrieving messages.
Spring Integration provides two convenient implementations of it:</p> <ul><li><p><code>SimpleMessageStore</code>: An in-memory, <code>Map</code>-based implementation (the default, good for testing)</p></li> <li><p><code>JdbcMessageStore</code>: An implementation that uses a relational database over JDBC</p></li></ul> <h3 id="codec"><a href="#codec" class="header-anchor">#</a> Codec</h3> <p>Version 4.2 of Spring Integration introduced the <code>Codec</code> abstraction.
Codecs encode and decode objects to and from <code>byte[]</code>.
They offer an alternative to Java serialization.
One advantage is that, typically, objects need not implement <code>Serializable</code>.
We provide one implementation that uses <a href="https://github.com/EsotericSoftware/kryo" target="_blank" rel="noopener noreferrer">Kryo<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> for serialization, but you can provide your own implementation for use in any of the following components:</p> <ul><li><p><code>EncodingPayloadTransformer</code></p></li> <li><p><code>DecodingTransformer</code></p></li> <li><p><code>CodecMessageConverter</code></p></li></ul> <h4 id="encodingpayloadtransformer"><a href="#encodingpayloadtransformer" class="header-anchor">#</a> <code>EncodingPayloadTransformer</code></h4> <p>This transformer encodes the payload to a <code>byte[]</code> by using the codec.
It does not affect message headers.</p> <p>See the <a href="https://docs.spring.io/spring-integration/api/org/springframework/integration/transformer/EncodingPayloadTransformer.html" target="_blank" rel="noopener noreferrer">Javadoc<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> for more information.</p> <h4 id="decodingtransformer"><a href="#decodingtransformer" class="header-anchor">#</a> <code>DecodingTransformer</code></h4> <p>This transformer decodes a <code>byte[]</code> by using the codec.
It needs to be configured with the <code>Class</code> to which the object should be decoded (or an expression that resolves to a <code>Class</code>).
If the resulting object is a <code>Message&lt;?&gt;</code>, inbound headers are not retained.</p> <p>See the <a href="https://docs.spring.io/spring-integration/api/org/springframework/integration/transformer/DecodingTransformer.html" target="_blank" rel="noopener noreferrer">Javadoc<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> for more information.</p> <h4 id="codecmessageconverter"><a href="#codecmessageconverter" class="header-anchor">#</a> <code>CodecMessageConverter</code></h4> <p>Certain endpoints (such as TCP and Redis) have no concept of message headers.
They support the use of a <code>MessageConverter</code>, and the <code>CodecMessageConverter</code> can be used to convert a message to or from a <code>byte[]</code> for transmission.</p> <p>See the <a href="https://docs.spring.io/spring-integration/api/org/springframework/integration/codec/CodecMessageConverter.html" target="_blank" rel="noopener noreferrer">Javadoc<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> for more information.</p> <h4 id="kryo"><a href="#kryo" class="header-anchor">#</a> Kryo</h4> <p>Currently, this is the only implementation of <code>Codec</code>, and it provides two kinds of <code>Codec</code>:</p> <ul><li><p><code>PojoCodec</code>: Used in the transformers</p></li> <li><p><code>MessageCodec</code>: Used in the <code>CodecMessageConverter</code></p></li></ul> <p>The framework provides several custom serializers:</p> <ul><li><p><code>FileSerializer</code></p></li> <li><p><code>MessageHeadersSerializer</code></p></li> <li><p><code>MutableMessageHeadersSerializer</code></p></li></ul> <p>The first can be used with the <code>PojoCodec</code> by initializing it with the <code>FileKryoRegistrar</code>.
The second and third are used with the <code>MessageCodec</code>, which is initialized with the <code>MessageKryoRegistrar</code>.</p> <h5 id="customizing-kryo"><a href="#customizing-kryo" class="header-anchor">#</a> Customizing Kryo</h5> <p>By default, Kryo delegates unknown Java types to its <code>FieldSerializer</code>.
Kryo also registers default serializers for each primitive type, along with <code>String</code>, <code>Collection</code>, and <code>Map</code>.<code>FieldSerializer</code> uses reflection to navigate the object graph.
A more efficient approach is to implement a custom serializer that is aware of the object’s structure and can directly serialize selected primitive fields.
The following example shows such a serializer:</p> <div class="language- extra-class"><pre class="language-text"><code>public class AddressSerializer extends Serializer&lt;Address&gt; {

    @Override
    public void write(Kryo kryo, Output output, Address address) {
        output.writeString(address.getStreet());
        output.writeString(address.getCity());
        output.writeString(address.getCountry());
    }

    @Override
    public Address read(Kryo kryo, Input input, Class&lt;Address&gt; type) {
        return new Address(input.readString(), input.readString(), input.readString());
    }
}
</code></pre></div><p>The <code>Serializer</code> interface exposes <code>Kryo</code>, <code>Input</code>, and <code>Output</code>, which provide complete control over which fields are included and other internal settings, as described in the <a href="https://github.com/EsotericSoftware/kryo" target="_blank" rel="noopener noreferrer">Kryo documentation<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <table><thead><tr><th></th> <th>When registering your custom serializer, you need a registration ID.<br>The registration IDs are arbitrary.<br>However, in our case, the IDs must be explicitly defined, because each Kryo instance across the distributed application must use the same IDs.<br>Kryo recommends small positive integers and reserves a few ids (value &lt; 10).<br>Spring Integration currently defaults to using 40, 41, and 42 (for the file and message header serializers mentioned earlier).<br>We recommend you start at 60, to allow for expansion in the framework.<br>You can override these framework defaults by configuring the registrars mentioned earlier.</th></tr></thead> <tbody></tbody></table> <h6 id="using-a-custom-kryo-serializer"><a href="#using-a-custom-kryo-serializer" class="header-anchor">#</a> Using a Custom Kryo Serializer</h6> <p>If you need custom serialization, see the <a href="https://github.com/EsotericSoftware/kryo" target="_blank" rel="noopener noreferrer">Kryo<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> documentation, because you need to use the native API to do the customization.
For an example, see the <a href="https://github.com/spring-projects/spring-integration/blob/main/spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/MessageCodec.java" target="_blank" rel="noopener noreferrer"><code>MessageCodec</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> implementation.</p> <h6 id="implementing-kryoserializable"><a href="#implementing-kryoserializable" class="header-anchor">#</a> Implementing KryoSerializable</h6> <p>If you have write access to the domain object source code, you can implement <code>KryoSerializable</code> as described <a href="https://github.com/EsotericSoftware/kryo#kryoserializable" target="_blank" rel="noopener noreferrer">here<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.
In this case, the class provides the serialization methods itself and no further configuration is required.
However benchmarks have shown this is not quite as efficient as registering a custom serializer explicitly.
The following example shows a custom Kryo serializer:</p> <div class="language- extra-class"><pre class="language-text"><code>public class Address implements KryoSerializable {
    ...

    @Override
    public void write(Kryo kryo, Output output) {
        output.writeString(this.street);
        output.writeString(this.city);
        output.writeString(this.country);
    }

    @Override
    public void read(Kryo kryo, Input input) {
        this.street = input.readString();
        this.city = input.readString();
        this.country = input.readString();
    }
}
</code></pre></div><p>You can also use this technique to wrap a serialization library other than Kryo.</p> <h6 id="using-the-defaultserializer-annotation"><a href="#using-the-defaultserializer-annotation" class="header-anchor">#</a> Using the <code>@DefaultSerializer</code> Annotation</h6> <p>Kryo also provides a <code>@DefaultSerializer</code> annotation, as described <a href="https://github.com/EsotericSoftware/kryo#default-serializers" target="_blank" rel="noopener noreferrer">here<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <div class="language- extra-class"><pre class="language-text"><code>@DefaultSerializer(SomeClassSerializer.class)
public class SomeClass {
       // ...
}
</code></pre></div><p>If you have write access to the domain object, this may be a simpler way to specify a custom serializer.
Note that this does not register the class with an ID, which may make the technique unhelpful for certain situations.</p></div> <footer class="page-edit"><div class="edit-link"><a href="https://gitcode.net/dev-cloud/spring-docs/-/blob/master/docs/en/spring-integration/message-transformation.md" target="_blank" rel="noopener noreferrer">Edit this page on GitCode</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">Last Updated:</span> <span class="time">Thu Mar 17 2022 18:19:53 GMT+0800</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">

      <a href="/en/spring-integration/message-routing.html" class="prev">
        Message Routing
      </a></span> <span class="next"><a href="/en/spring-integration/messaging-endpoints.html">
        Messaging Endpoints
      </a>

    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/assets/js/app.cf11b18e.js" defer></script><script src="/assets/js/3.50918073.js" defer></script><script src="/assets/js/4.cd4c3ff4.js" defer></script><script src="/assets/js/128.456206df.js" defer></script>
  </body>
</html>