I have a web service running on my dev box implemented using Spring-MVC 3.0. I have various JUnits that test against that service using RestTemplate. What I would like to do is have JMeter pick up those JUnits REST requests when I run them. However, to do that, I need to have Spring's RestTemplate send them to the proxy that I'm running JMeter on. So, the question is, how can I do that?
I've done something similar with CXF and their http:conduit and http:client stuff, but I really have no idea how to do this with Spring-MVC.
put these lines before calling your get or post method. so proxy get set .
Alternatively you can use runtime parameters:
Spring has a good documentation using a Customizer to determine different proxy
and the call to apply the ProxyCustomizer is
Sadly, this was really easy.
@AHungerArtist's answer works for simple use cases, where you want all requests to use the same proxy. If you need some requests through restTemplate to use the proxy, and others to not, though, you may find this more useful. (Or if you just like doing it programmatically more than you like mucking with system properties!)
You should be able to create a copy of the restTemplate bean that way, and another one the normal way, so you can send requests with and without the proxy.