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.

        Issue Links

          Activity

          Show
          arjen.poutsma Arjen Poutsma added a comment - Fixed in https://github.com/spring-projects/spring-framework/commit/f3975776d4b55f5b49fc504fea3f6e3c09a3238a

            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:
                17 weeks ago