数据库查询
1、进入SpringBoot官网,点击GUIDES,搜索MySQL
2、在Create the database中,将以下代码复制到MySQL的新建查询中
create database db_example; – Create the new database create user ‘springuser’@’%’ identified by ‘ThePassword’; – Creates the user grant all on db_example.* to ‘springuser’@’%’; – Gives all the privileges to the new user on the newly created database
3、打开IDEA,选择web、JPA以及MySQL,将官网Create the application.properties file中的代码复制到application.properties中;接着将Create the @Entity model、Create the repository、Create a new controller for your Spring application、Make the application executable以及Test the application的代码复制在src的main中(在各文档上有官网的详细解释)