1、修改端口号主要是通过配置文件修改。如图:
IntelliJ IDEA 2017版 spring-boot修改端口号配置把端口号改为8081

完整版配置

 1 ########################################################
 2 ###server 配置信息
 3 ########################################################
 4 #spring boot 端口号配置
 5 server.port = 8081
 6 #spring boot 默认访问路径是/
 7 server.context-path = /springboot
 8 server.tomcat.uri-encoding = UTF-8
 9 
10 
11 #######################################################
12 ##datasource -- 指定mysql数据库连接信息.
13 #######################################################
14 spring.datasource.url = jdbc:mysql://localhost:3306/test
15 spring.datasource.username = root
16 spring.datasource.password = 123456
17 spring.datasource.driverClassName = com.mysql.jdbc.Driver
18 spring.datasource.max-active=20
19 spring.datasource.max-idle=8
20 spring.datasource.min-idle=8
21 spring.datasource.initial-size=10
22 
23 
24 ########################################################
25 ### Java Persistence Api --  Spring jpa的配置信息.
26 ########################################################
27 # Specify the DBMS
28 spring.jpa.database = MYSQL
29 # Show or not log for each sql query
30 spring.jpa.show-sql = true
31 # Hibernate ddl auto (create, create-drop, update)
32 spring.jpa.hibernate.ddl-auto = update
33 # Naming strategy
34 #[org.hibernate.cfg.ImprovedNamingStrategy  #org.hibernate.cfg.DefaultNamingStrategy]
35 spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
36 # stripped before adding them to the entity manager)
37 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
View Code

相关文章: