You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@ImportAutoConfiguration
@PropertyMapping("spring.test.webclient")
public @interface AutoConfigureWebClient {
/**
* If a {@link RestTemplate} bean should be registered. Defaults to {@code false} with
* the assumption that the {@link RestTemplateBuilder} will be used.
* @return if a {@link RestTemplate} bean should be added.
*/
boolean registerRestTemplate() default false;
/**
* The HTTP service to create a proxy for
*
* @return the class of the HTTP service
*/
Class<?> value();
/**
* The based url that will be used by the proxy
*
* @return the based url
*/
String url() default "";
}
As a result, developers will be able to autoconfigure their Http interface client in their testing class like this :
Hi @bclozel ,
Should I post a comment in #31337 or the testing part is already taken into account in that issue ? I have seen this issue before opening mine but I did not see anything regarding tests...
Thank you in advance for the clarifications
@mathieu-amblard Yes I think considering the test aspects there should be a good idea. In the end we can choose to tackle it separately but I think design considerations should be discussed there. We can always reopen this one if we think it's worth it.
As far as I know, there is no annotation available that automatically configures an HTTP interface client for Spring Boot Test slice testing.
Currently, I am implementing my HTTP interface client tests like this :
I suggest to make the AutoConfigureWebClient annotation evolve and add two new parameters :
As a result, developers will be able to autoconfigure their Http interface client in their testing class like this :
I would be glad to open a pull request if this new feature suits you.
The text was updated successfully, but these errors were encountered: