先向你们介绍几个框架的做用,提供官网地址,方便你们详细了解。前端
1<dependencies>
2 <dependency>
3 <groupId>org.springframework.boot</groupId>
4 <artifactId>spring-boot-starter-data-jpa</artifactId>
5 </dependency>
6 <dependency>
7 <groupId>org.springframework.boot</groupId>
8 <artifactId>spring-boot-starter-web</artifactId>
9 </dependency>
10
11 <dependency>
12 <groupId>org.projectlombok</groupId>
13 <artifactId>lombok</artifactId>
14 <optional>true</optional>
15 </dependency>
16 <dependency>
17 <groupId>org.springframework.boot</groupId>
18 <artifactId>spring-boot-starter-test</artifactId>
19 <scope>test</scope>
20 <exclusions>
21 <exclusion>
22 <groupId>org.junit.vintage</groupId>
23 <artifactId>junit-vintage-engine</artifactId>
24 </exclusion>
25 </exclusions>
26 </dependency>
27 <dependency>
28 <groupId>org.springframework.boot</groupId>
29 <artifactId>spring-boot-starter-security</artifactId>
30 </dependency>
31
32 <dependency>
33 <groupId>org.springframework.security</groupId>
34 <artifactId>spring-security-test</artifactId>
35 <scope>test</scope>
36 </dependency>
37 <dependency>
38 <groupId>io.jsonwebtoken</groupId>
39 <artifactId>jjwt</artifactId>
40 <version>0.9.1</version>
41 </dependency>
42 <dependency>
43 <groupId>mysql</groupId>
44 <artifactId>mysql-connector-java</artifactId>
45 <scope>runtime</scope>
46 </dependency>
47 </dependencies>
复制代码
数据库建表
由于我的使用的是JPA数据库管理框架因此直接就能够在代码里写好model就能够在数据库里生成对应的表,相应的代码会在后面给出github的项目地址,在这里就放张图给你们看下
java
application.yml的相关配置node
1#server
2server.servlet.context-path=/api
3
4#spring
5spring.datasource.url=jdbc:mysql://localhost:3306/java-umi?useUnicode=true&characterEncoding=utf8&useSSL=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
6spring.datasource.username=数据库用户名
7spring.datasource.password=数据库密码
8spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
9
10## jpa
11spring.jpa.show-sql=true
12spring.jpa.hibernate.ddl-auto=update
13spring.jpa.properties.hibernate.format_sql=true
复制代码
项目github地址: spring-security-jwt-umimysql
这一章先讲springboot项目的基础配置,有关spring-security的核心内容和流程,将在下一章展开。git
欢迎你们关注我微信公众号一块儿学习,探讨!
github