修改端口号
方式1:
@RestController
@SpringBootApplication
public class App extends SpringBootServletInitializer implements EmbeddedServletContainerCustomizer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(App.class);
}
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.setPort(9999);
}
public static void main( String[] args )
{
SpringApplication.run(App.class, args);
}
}
方式2
在resources中加入application.properties文件,在配置文件中加入:server.port=9999
方式3
1,implements EmbeddedServletContainerCustomizer
2, @Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.setPort(8011);
}
@Controller
@ResponseBody
和@RestController是一样的
获取域名
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()
网友评论