jpaas-user 依赖项目与第三方库
jpaas-user是平台的组织架构与认证数据来源的支撑后端子项目,它依赖了以下几块:
平台子模块
- jpaas-auth 统一认证
- jpaas-gateway 网关
- jpaas-config 配置中心
- jpaas-share 公共实体模块
依赖平台的公共模块
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-config</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-share</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-common-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-cache-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-db-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-redis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-ribbon-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-sentinel-spring-boot-starter</artifactId>
</dependency>
<!-- swagger -->
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-swagger2-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-auth-client-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-web-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.redxun</groupId>
<artifactId>jpaas-common-dto</artifactId>
</dependency>
依赖 Spring boot的部分模块
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-security</artifactId>
</dependency>
其他功能包
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-seata</artifactId>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-all</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
<dependency>
<groupId>com.taobao</groupId>
<artifactId>usersync</artifactId>
<version>1.0</version>
</dependency>
代码运行
依赖数据库jpaas-user
先在数据库中创建jpaas-user,请参考4.平台源码运行的脚本执行。
nacos的数据库配置
依赖了nacos的,需要在nacos中配置流程模块的数据库连接:
进入nacos的配置,找到相应的环境的配置文件,如在开发环境下使用的是dev的配置文件:
代码如下:
user.datasource.url=jdbc:mysql://localhost:3308/jpaas_user?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8
user.datasource.username=root
user.datasource.password=root
user.datasource.driver=com.mysql.cj.jdbc.Driver
user.datasource.connection=
进入编辑页,项目的application.yml,检查以下信息 是否如下,一般来说不用修改:
defaultDs:
string:
url: ${user.datasource.url}
username: ${user.datasource.username}
password: ${user.datasource.password}
driver-class-name: ${user.datasource.driver}
connection-init-sqls: ${user.datasource.connection}
validationQuery: select 1
filters: stat
int:
initialSize: 5
minIdle: 5
maxActive: 10
maxPoolPreparedStatementPerConnectionSize: 20
long:
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
boolean:
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
运行依赖
需要优先启动以下几个模块
- nacos
- seata
- jpaas-auth
- jpaas-gateway
- jpaas-user
然后再运行本模块即可,即执行JpaasUserApplication类即可,在Idea中的启动项,配置nacos.address地址
文档更新时间: 2020-09-28 09:37 作者:csx