chen-msg
package com.tsou.Controller;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

@Controller
@EnableAutoConfiguration
public class SampleController implements EmbeddedServletContainerCustomizer {


    @RequestMapping("/")
    @ResponseBody
    String home() {
        return "Hello World! 你哈1你好 ";
    }

    public static void main(String[] args) {
        SpringApplication.run(SampleController.class, args);
    }
    @Override
    public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) {
        configurableEmbeddedServletContainer.setPort(8003);
    }

}

修改为:8003

或者修改配置文件端口:server.port=8003

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-08-26
  • 2022-01-13
  • 2021-05-04
猜你喜欢
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案