先向你們介紹幾個框架的做用,提供官網地址,方便你們詳細瞭解。前端
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