Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15816

AbstractCodecConfigurer creates Jackson Encoders/Decoders each time when getters are called

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0 RC2
    • Fix Version/s: 5.0 RC4
    • Component/s: Web
    • Labels:
    • Last commented by a User:
      false

      Description

      AbstractCodecConfigurer #getReaders #getWriters methods create new instances of Jackson2JsonDecoder and Jackson2JsonEncoder each time when getters are called, by default.
      This happens because of this code:

      		protected Jackson2JsonEncoder jackson2Encoder() {
      			return this.jackson2Encoder != null ? this.jackson2Encoder : new Jackson2JsonEncoder();
      		}
      		protected Jackson2JsonDecoder jackson2Decoder() {
      			return this.jackson2Decoder != null ? this.jackson2Decoder : new Jackson2JsonDecoder();
      		}
      

      The Jackson2JsonDecoder and Jackson2JsonEncoder internally are using org.springframework.util.ClassUtils.forName blocking method, which leads to blocking reactor-http-nio threads.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                arjen.poutsma Arjen Poutsma
                Reporter:
                bduisenov Babur Duisenov
                Last updater:
                St├ęphane Nicoll
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  47 weeks, 3 days ago