Hello there! My project structure:
module:
* common
* api
* use common as denpendency
I have a jackson config like below:
@JsonComponent
public class CustomCombinedSerializers {
public static class MyZonedDateTimeSerializer extends ZonedDateTimeSerializer {
protected MyZonedDateTimeSerializer() {
super(DateTransformer.ISO_TIMESTAMP_FORMATTER);
}
}
public static class MyLocalDateTimeSerializerSerializer extends LocalDateTimeSerializer {
protected MyLocalDateTimeSerializerSerializer() {
super(DateTransformer.ISO_TIMESTAMP_FORMATTER);
}
}
public static class MyLocalDateTimeSerializerDeserializer extends LocalDateTimeDeserializer {
protected MyLocalDateTimeSerializerDeserializer() {
super(DateTransformer.ISO_TIMESTAMP_FORMATTER);
}
}
}
I want to reuse this CustomCombinedSerializers in both common and api module, cause they all need @jsontest slice tests.
But I found that if I put CustomCombinedSerializers class in common module(specify package with @componentscan manully), @jsontest slice tests in api cannot load CustomCombinedSerializers class(jackson configuration not working). I move CustomCombinedSerializers class back to api module, it is working. Is there any method can address this problem?
Comment From: snicoll
specify package with @componentscan manully
It's hard to say what your test setup is or where the @ComponentScan directive is located. Please review the reference documentation. If you still need support, share a small sample that we can run ourselves to reproduces the problem.
Comment From: sudowanderer
@snicoll Thanks a lot ! I read the documentation. Problem 's gone!