DataSource
HttpMessageConverter<Model>
which reads the message from http request so that we receive the Model in the controller method. I need to know if I can add another thing to the chain after HttpMessageConverter
to handle the validation. Filter cannot be used since it is before HttpMessageConverter
Hi, I need to add an implicit validation to all incoming requests with specific request body or request parameter as part the request lifecycle and return 400 in it's not valid. validation definition comes as part of the request message model. we do have
HttpMessageConverter<Model>
which reads the message from http request so that we receive the Model in the controller method. I need to know if I can add another thing to the chain afterHttpMessageConverter
to handle the validation. Filter cannot be used since it is beforeHttpMessageConverter
Any suggestions ? :pray:
Hello! In order to do retries with a feign client, I've been following this documentation: spring-cloud-feign-overriding-defaults. It seemed to me extremely easy and I created the @Configuration
class and modified the @FeignClient
overriding its configuration this way:
@FeignClient(value = “service”, url = "\${service.url}", configuration = [ServiceConfig::class])
@Configuration
class ServiceConfig {
@Bean
fun retryFactory(): Retryer = Retryer.Default()
}
But it doesn’t work. Am I missing something? I will appreciate so much any help!
@SpringBootTest
classes will want different configurations
Hello! I'm seeing some issues with a class (class A) marked with Configurable annotation autowiring another class. Class A is being manually instantiated by Class X that's not Spring managed. Class A is autowiring class B. There is a delay in the instantiation order of Class A and class B. As a result, we end up hitting an NPE in class A, when it tries to invoke a method in class B. I tried debugging the issue to see in what order the 2 classes are being instantiated. I'm seeing two issues here - 1) post construct method in class A is never called 2) post construct method in class B is being called 2-3 minutes after I see a log message from an init function in class A. I've tried setting @Configurable(preconstruct = true, autowire=Autowire.BY_NAME), but no luck. Any comments/suggestions?
@aghag10 1) try to instantiate your class A by Spring itself. 2) don't use
@Autowire
on propertyprivate ClassB classB
, turn it out to ClassA's constructor param.
@bvn13 1) I can't make class A spring managed since class X that's instantiating class A can not be made Spring managed. 2) I don't follow. If that's the case, class B won't be autowired anymore?
Hello! I'm seeing some issues with a class (class A) marked with Configurable annotation autowiring another class. Class A is being manually instantiated by Class X that's not Spring managed. Class A is autowiring class B. There is a delay in the instantiation order of Class A and class B. As a result, we end up hitting an NPE in class A, when it tries to invoke a method in class B. I tried debugging the issue to see in what order the 2 classes are being instantiated. I'm seeing two issues here - 1) post construct method in class A is never called 2) post construct method in class B is being called 2-3 minutes after I see a log message from an init function in class A. I've tried setting @Configurable(preconstruct = true, autowire=Autowire.BY_NAME), but no luck. Any comments/suggestions?
@aghag10 1) try to instantiate your class A by Spring itself. 2) don't use
@Autowire
on propertyprivate ClassB classB
, turn it out to ClassA's constructor param.@bvn13 1) I can't make class A spring managed since class X that's instantiating class A can not be made Spring managed. 2) I don't follow. If that's the case, class B won't be autowired anymore?
1) I got it. 2) This way - yes. But I've found an example of how to get spring bean from outside of spring-managed zone https://confluence.jaytaala.com/display/TKB/Super+simple+approach+to+accessing+Spring+beans+from+non-Spring+managed+classes+and+POJOs
http
anymore