SpringBoot中遇到的一些问题

1.热部署配置

除了要引一个节点

<!-- 可以实现热部署 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>

可以实现热部署,在IDEA上实现热部署还需一些额外 的配置,配置过程如下:

步骤1:打开idea ,File->Settings-> Build-Execution-Deployment -> Compiler--->勾选 Build Project Automatically.

步骤2: 按 Shift+Ctrl+A (windows,mac是 command+shift+A) 将看到弹窗 Enter Action or option name,输入"registry",双击第一项"Registry..." ,会弹出另一个窗口,寻找 compiler.automake.allow.when.app.running 这一项,并勾选开启。然后关闭窗口。 

2.解决8080端口占用问题

在dos下,输入 netstat -ano|findstr 8080

//说明:查看占用8080端口的进程

显示占用端口的进程

taskkill /pid 4708 /f

//说明,运行windows自带taskkill命令,将上面显示的进程号, 结束掉。

3.使用命令行启动SpringBoot项目(要有maven环境)

(spring-boot-maven-plugin)插件

编译 mvn package   

启动 mvn spring-boot:run

编译效果

启动效果

猜你喜欢

转载自www.cnblogs.com/my-123/p/9214629.html