我需要什么配置才能通过spring发送HTTP post请求.我使用的是java应用程序,它不是一个Web项目.我可以使用spring发送HTTP post请求吗?我谷歌它,但几乎所有的例子都使用spring MVC.我可以使用spring发送HTTP post请求吗?
我在网上发现了这个豆子,但我不知道该怎么办.我使用的是spring3.2,这个帖子我认为是2008年...
<bean id="httpClient" class="org.springbyexample.httpclient.HttpClientTemplate">
<property name="defaultUri">
<value><![CDATA[http://localhost:8093/test]]></value>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
有什么建议?
您不需要 Spring 来发出 HTTP 请求,请参阅此帖子:Using java.net.URLConnection to fire and handler HTTP requests
是的,您可以在非 Web 应用程序/命令行应用程序中使用 Spring。只需创建一个 ApplicationContext 实例(例如:ClassPathApplicationContext 以及注入的 beans xml 配置路径)
归档时间: |
|
查看次数: |
31889 次 |
最近记录: |