開發一個博客系統文章數:菜單文章都沒更新完
搭建eureka註冊中心 (請先閱讀此文章) https://segmentfault.com/a/11...
搭建Beans編寫Token解析註解 https://segmentfault.com/a/11...
搭建權限管理系統 https://segmentfault.com/a/11...
搭建後臺管理系統 https://segmentfault.com/a/11...
前端Fetch請求封裝 https://segmentfault.com/a/11...前端
權限圖:
java
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.server</groupId> <artifactId>authority</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>authority</name> <description>authority project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud.version>Camden.SR6</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>com.server</groupId> <artifactId>beans</artifactId> <version>1.0-SNAPSHOT</version> <!--這是個人beans--> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-feign</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.11</version> </dependency> <!-- SpringData-Jpa依賴--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
配置文件application.properties
eureka.client.serviceUrl.defaultZone=http://system:123456@localhost:8081/eureka eureka.instance.prefer-ip-address=true spring.application.name=AUS server.port=8767 security.basic.enabled=false #security.user.name=system #security.user.password=123456 spring.datasource.url=jdbc:mysql://localhost:3306/dbauth?characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false spring.datasource.username=root #root,root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver <!--我使用的MySQl版本比較高因此使用該驅動--> spring.jpa.properties.hibernate.hbm2ddl.auto=update #create-drop spring.jpa.show-sql=true
啓動類
@SpringBootApplication @EnableEurekaClient public class AuthorityApplication { public static void main(String[] args) { SpringApplication.run(AuthorityApplication.class, args); } }
而後沒有了mysql