spring - Spring RESTful Web 服务的端口绑定(bind)

标签 spring web-services

我用过Building a RESTful Web Service为我的目的构建 WebService 的教程。这很容易,但现在我正在努力配置应该绑定(bind) WebService 的端口。没有config.xml或在此项目中配置的任何内容。谁能给我一个关于如何配置 WebService 端口的提示?

因为这些细节可能会有所帮助。我正在使用以下代码启动服务器,其中包含 @EnableAutoConfiguration标签。配置由 Spring Boot 完成.

@ComponentScan
@EnableAutoConfiguration
public class ServerStarter{

public static void main(String[] args) {
        SpringApplication.run(ServerStarter.class, args);
    }
}

最佳答案

要配置端口,您可以通过在“src/main/resources”下的“application.properties”文件中写入以下内容来设置 server.port 和 management.port 属性:

server.port = 9000
management.port = 9001

同样如果需要指定管理地址:
management.address = 127.0.0.1

您可以为服务器和管理服务器设置更多属性。参见 spring-boot 的文档:http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/

关于spring - Spring RESTful Web 服务的端口绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20520589/

相关文章:

java - Camel : redirect to url received by parameter

.net - servicestack 自托管服务使用分块编码 - 是无缓冲的吗?

java - Axis2 系统无法推断传输信息错误

java - maven 问题 ArtifactDescriptorException

java - 如何强制执行 Spring 配置类的加载顺序?

Spring Webflow 2.4.2 缺少启动状态

java - 如何判断文件上传/下载 JAX-WS Web 服务是流式传输还是缓冲式?

java - 相当于 wsimport 的 org.apache.axis.components.net.SunFakeTrustSocketFactory

java - HttpResponse 正文正在更改

javascript - 刷新简单验证码