+3
-1
@@ -16,7 +16,7 @@
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile Jackson3AutoConfiguration.kt
|
||||
* LastUpdate 2026-03-11 08:46:40
|
||||
* LastUpdate 2026-10-02 16:11:12
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mingliqiye.utils.json.converters.base.getJackson3Module
|
||||
import com.mingliqiye.utils.logger.MingLiLoggerFactory
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.jackson.autoconfigure.JsonMapperBuilderCustomizer
|
||||
import org.springframework.context.annotation.Bean
|
||||
|
||||
@@ -38,6 +39,7 @@ open class Jackson3AutoConfiguration {
|
||||
private val logger = MingLiLoggerFactory.getLogger<Jackson3AutoConfiguration>()
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(JsonMapperBuilderCustomizer::class)
|
||||
open fun myJsonMapperCustomizer(): JsonMapperBuilderCustomizer {
|
||||
return JsonMapperBuilderCustomizer { builder ->
|
||||
builder
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile Jackson3JsonApiAutoConfiguration.kt
|
||||
* LastUpdate 2026-06-21 10:40:58
|
||||
* LastUpdate 2026-10-02 16:11:02
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ open class Jackson3JsonApiAutoConfiguration {
|
||||
private val logger = MingLiLoggerFactory.getLogger<Jackson3JsonApiAutoConfiguration>()
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnMissingBean(JsonApi::class)
|
||||
open fun jsonApi(jsonMapper: JsonMapper): JsonApi {
|
||||
return Jackson3JsonApi(
|
||||
get = { jsonMapper },
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile JacksonAutoConfiguration.kt
|
||||
* LastUpdate 2026-03-11 08:46:40
|
||||
* LastUpdate 2026-10-02 16:10:53
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
@@ -91,7 +91,7 @@ open class JacksonAutoConfiguration(objectMapper: ObjectMapper) {
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnMissingBean(JsonApi::class)
|
||||
open fun jsonApi(objectMapper: ObjectMapper): JsonApi {
|
||||
return JacksonJsonApi(objectMapper).also {
|
||||
log.info("JsonApi Bean Auto Configuration Success")
|
||||
|
||||
+5
-3
@@ -16,7 +16,7 @@
|
||||
* ProjectName mingli-utils
|
||||
* ModuleName mingli-utils.main
|
||||
* CurrentFile Okhttp3AutoConfiguration.kt
|
||||
* LastUpdate 2026-02-27 17:40:32
|
||||
* LastUpdate 2026-10-02 16:10:15
|
||||
* UpdateUser MingLiPro
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.slf4j.Logger
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.event.ContextClosedEvent
|
||||
import org.springframework.context.event.EventListener
|
||||
@@ -43,14 +44,15 @@ open class Okhttp3AutoConfiguration {
|
||||
open var userDefinedBuilder: okhttp3.OkHttpClient.Builder? = null
|
||||
|
||||
open fun initOkHttpClient() {
|
||||
if (userDefinedBuilder == null) {
|
||||
okHttpClient = okhttp3.OkHttpClient()
|
||||
okHttpClient = if (userDefinedBuilder == null) {
|
||||
okhttp3.OkHttpClient()
|
||||
} else {
|
||||
userDefinedBuilder!!.build()
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
open fun okHttpClient(): okhttp3.OkHttpClient {
|
||||
if (okHttpClient == null) {
|
||||
initOkHttpClient()
|
||||
|
||||
Reference in New Issue
Block a user