springboot项目搭建

springboot项目

新建项目

1.包名:cy.store
2.导入依赖:

 

 

3.在properties中配置:
spring.datasource.username=root
spring.datasource.password=aa123456
spring.datasource.url=jdbc:mysql://localhost:3306/house?useSSl=true&useUnicode=true&characterEncoding=UTF-8
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

#整合mybatis
#mybatis.type-handlers-package=com.example.pojo
#mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
4.创建数据库:

可视化界面创建即可

5.链接数据库

1.先运行主类看一看有没有springboot编制标志

2.在test中测试,自动装配datasorce

6.加载静态资源

直接放在static当中,你放在thymleaf需要controller跳转的

1.maven : clear install

2.重启idea

 

posted @ 2022-03-05 21:17  爽爽子的秃头生活  阅读(43)  评论(0)    收藏  举报