Skip to content

Commit

Permalink
Merge pull request #79
Browse files Browse the repository at this point in the history
Remove publicKey lazy initialization and add Feign response coder config
  • Loading branch information
MichiBaum authored Nov 4, 2024
2 parents 3eb9c06 + 5df51e3 commit 5077b5c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.michibaum.admin_service.security

import feign.codec.Decoder
import feign.codec.Encoder
import org.springframework.beans.factory.ObjectFactory
import org.springframework.boot.autoconfigure.http.HttpMessageConverters
import org.springframework.cloud.openfeign.support.SpringDecoder
import org.springframework.cloud.openfeign.support.SpringEncoder
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

/**
* https://github.com/spring-cloud/spring-cloud-openfeign/issues/235
* fanticat opened this issue on Oct 22, 2019 · 10 comments
*/
@Configuration
class FeignResponseCoderConfig {

private val messageConverters = ObjectFactory { HttpMessageConverters() }

@Bean
fun feignEncoder(): Encoder {
return SpringEncoder(messageConverters)
}

@Bean
fun feignDecoder(): Decoder {
return SpringDecoder(messageConverters)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ class JwsValidator(
val logger = org.slf4j.LoggerFactory.getLogger(this.javaClass)

private var publicKey: RSAPublicKey? = null
get() {
if (field == null) {
reloadPublicKey()
}
return field
}

fun reloadPublicKey() {
val dto = try {
Expand Down

0 comments on commit 5077b5c

Please sign in to comment.