Kotlin Serialization Spring Integration

Hi I encountered a problem, I am currently trying to create unit test in order to test my API responses but I just found out that even by specifying that I want spring to use kotlin serialization to serialize controller responses it doesn't not work. Here is my configuration:
@Configuration
class WebSerializationConfiguration: WebMvcConfigurer {
private val converter = KotlinSerializationJsonHttpMessageConverter(DEFAULT_JSON)

override fun configureMessageConverters(converters: MutableList<HttpMessageConverter<*>>) {
converters.add(this.converter)
}
}
@Configuration
class WebSerializationConfiguration: WebMvcConfigurer {
private val converter = KotlinSerializationJsonHttpMessageConverter(DEFAULT_JSON)

override fun configureMessageConverters(converters: MutableList<HttpMessageConverter<*>>) {
converters.add(this.converter)
}
}
I even tried to just remove the json from my dependency:
implementation("org.springframework.boot:spring-boot-starter-web") {
exclude("org.springframework.boot:spring-boot-starter-json")
}
implementation("org.springframework.boot:spring-boot-starter-web") {
exclude("org.springframework.boot:spring-boot-starter-json")
}
But it doesn't work and I get a weird serializable
3 Replies
JavaBot
JavaBot15mo ago
This post has been reserved for your question.
Hey @Pseudow! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Pseudow
PseudowOP15mo ago
An annotation was missing
JavaBot
JavaBot15mo ago
Post Closed
This post has been closed by <@1123703840739442698>.

Did you find this page helpful?