ieda 新建 springboot 项目初次运行

ieda 新建 springboot 项目初次运行

  • ieda 新建 springboot 项目初次运行
    • 项目前提
    • 用idea新建springboot项目
    • 更改配置文件, 第一次试运行
    • 点击SimpleApplication文件, 找到main方法, 点击左侧小绿标开始运行

ieda 新建 springboot 项目初次运行

前言: 程序猿自学到底好不好, 我的答案, 初级程序猿自学并不好, 所以如果你是前端想转java, 并且在公司没有提供任何帮助的情况下, 建议您不要观看.

项目前提

项目前提: 
	idea编码器
	需要有一定的代码基础, 
	需要安装idea浏览器, 
	安装好mysql数据库, 
	配置好java环境, 
	最好再安装一个navicat

用idea新建springboot项目

①, 最左上角有个 file 按钮, 依次点击
file --> new --> project
②, 输入项目名
ieda 新建 springboot 项目初次运行_第1张图片
③, 选择需要导入的包
ieda 新建 springboot 项目初次运行_第2张图片
ieda 新建 springboot 项目初次运行_第3张图片
ieda 新建 springboot 项目初次运行_第4张图片

更改配置文件, 第一次试运行

①, springboot项目需要注意的几个文件
ieda 新建 springboot 项目初次运行_第5张图片

 /* 1, pom.xml 是maven仓库, springboot能否顺利运行, 取决于pom.xml中该项目导入包的完整性, 以及java代码的完整性
  	2, .xml 文件多为配置文件
  	3, application.properties 是springboot项目的配置文件 可改为.yml或者.xml等后缀的文件, 当然修改了文件后缀, 文件的内容**格式**也应该修改
 */ 

②, 修改springboot配置文件 application.properties
原文件夹内容应该为空, 改为

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# 注意 根据导入mysql的版本问题, driver-class-name会出现改变, 如果不确定自己的版本号, 两个都试试,[doge]
# mysql 8或者Connector/J 8.0 对应的 driverClass 是 com.mysql.cj.jdbc.Driver
# Connector/J 5.1对应的是 com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/pm?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=GMT%2B8
# 数据库url
spring.datasource.username=root
# 数据库username
spring.datasource.password=123456
# 数据库密码

server.port=8088
# 定义运行的端口
server.servlet.context-path=/cat
# 定义端口后面的后缀 一般运行结果为 http://localhost:8088/cat

点击SimpleApplication文件, 找到main方法, 点击左侧小绿标开始运行

ieda 新建 springboot 项目初次运行_第6张图片

你可能感兴趣的:(新建项目,新手,spring,boot,intellij-idea,java)