新增通用starter,新增nacos-starter,gateway兼容cas,新增Profiles配置

This commit is contained in:
lhc
2021-03-02 16:29:57 +08:00
parent 826501a377
commit 094010b985
23 changed files with 1199 additions and 190 deletions

View File

@@ -14,36 +14,13 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<java.cas.client.version>3.5.0</java.cas.client.version>
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>net.unicon.cas</groupId>-->
<!-- <artifactId>cas-client-autoconfig-support</artifactId>-->
<!-- <version>1.4.0-GA</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.jasig.cas.client</groupId>-->
<!-- <artifactId>cas-client-core</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>com.liu</groupId>
<artifactId>cas_client-gateway-spring-boot-starter</artifactId>
<groupId>com.hcframe</groupId>
<artifactId>hcframe-gateway-cas-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.jasig.cas.client</groupId>-->
<!-- <artifactId>cas-client-core</artifactId>-->
<!-- <version>${java.cas.client.version}</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/org.jasig.cas.client/cas-client-integration-tomcat-common -->
<dependency>
<groupId>org.jasig.cas.client</groupId>
<artifactId>cas-client-integration-tomcat-common</artifactId>
<version>${java.cas.client.version}</version>
</dependency>
<dependency>
<groupId>com.hcframe</groupId>
<artifactId>hcframe-base</artifactId>
@@ -59,11 +36,6 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<!-- gateway -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>

View File

@@ -0,0 +1,115 @@
server:
port: 8084
spring:
cloud:
nacos:
discovery:
server-addr: 192.168.1.131:8848
namespace: 2e9f0148-751e-4da2-83ec-cb00ffe0d83a
gateway:
discovery:
locator:
# 是否和服务注册与发现组件结合,设置为 true 后可以直接使用应用名称调用服务
enabled: true
routes:
- id: user
uri: lb://cloud-user
predicates:
- Path=/user/**
- id: config
uri: lb://cloud-config
predicates:
- Path=/config/**
datasource:
druid:
# 配置sqlite文件路径需要填写绝对路径推荐将sqlite文件放入到服务器上而非程序jar包或war包中
driver-class-name: org.sqlite.JDBC
url: jdbc:sqlite:/Volumes/DATA/ideaProject/common-frame/hcframe/hcframe-parent/hcframe-config/src/main/resources/datasource.db
# url: jdbc:sqlite:D:/nacos-server-1.4.1/datasource.db
username:
password:
#使用Druid数据源
initialSize: 5
# 初始化大小,最小,最大
minIdle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: select 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat,slf4j
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 若不使用redis需要注释掉此类信息
redis:
database: 0
host: 192.168.100.145
port: 6379
password: root
lettuce:
pool:
# 连接池中的最大空闲连接 默认8
max-idle: 8
# 连接池中的最小空闲连接 默认0
min-idle: 0
# 连接池最大连接数 默认8 ,负数表示没有限制
max-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认-1
max-wait: -1
timeout: 30000
eureka:
client:
service-url:
# defaultZone: http://admin:123456@tomcat1:8080/eureka/
defaultZone: http://admin:123456@192.168.4.119:8081/eureka/
# 框架配置
frame:
# 是否开启redis 用户登录若开启此项需要配置redis节点及相关配置若不开启需要注释掉redis相关配置信息
isRedisLogin: true
# 用户登陆超时设置单位为小时此值不能为0
loginTimeout: 4
# 是否开启controller日志监控
showControllerLog: true
# swagger配置
swagger:
# 配置controller包路径
path: com.hcframe.module.**.controller
# 是否开启权限
enableAuth: false
# 用户名
username: admin
# 密码
password: admin
# Druid连接配置
druid:
# Druid用户名
username: test
# Druid密码
password: test
# Druid 允许访问的IP,默认全部允许
# allow: 127.0.0.1
# Druid 拒绝访问的IP,默认不拒绝全部
# deny: 10.0.0.2
feign:
client:
config:
default:
connectTimeout: 300000
readTimeout: 30000
loggerLevel: basic
okhttp:
enabled: true
hystrix:
enabled: true
hcframe:
cas:
casServiceUrl: http://192.168.1.131:8080
serviceUrl: http://192.168.4.130:8084
clientContextPath: /

View File

@@ -0,0 +1,115 @@
server:
port: 8084
spring:
cloud:
nacos:
discovery:
server-addr: 192.168.1.131:8848
namespace: 2e9f0148-751e-4da2-83ec-cb00ffe0d83a
gateway:
discovery:
locator:
# 是否和服务注册与发现组件结合,设置为 true 后可以直接使用应用名称调用服务
enabled: true
routes:
- id: user
uri: lb://cloud-user
predicates:
- Path=/user/**
- id: config
uri: lb://cloud-config
predicates:
- Path=/config/**
datasource:
druid:
# 配置sqlite文件路径需要填写绝对路径推荐将sqlite文件放入到服务器上而非程序jar包或war包中
driver-class-name: org.sqlite.JDBC
url: jdbc:sqlite:/Volumes/DATA/ideaProject/common-frame/hcframe/hcframe-parent/hcframe-config/src/main/resources/datasource.db
# url: jdbc:sqlite:D:/nacos-server-1.4.1/datasource.db
username:
password:
#使用Druid数据源
initialSize: 5
# 初始化大小,最小,最大
minIdle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: select 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat,slf4j
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 若不使用redis需要注释掉此类信息
redis:
database: 0
host: 192.168.100.145
port: 6379
password: root
lettuce:
pool:
# 连接池中的最大空闲连接 默认8
max-idle: 8
# 连接池中的最小空闲连接 默认0
min-idle: 0
# 连接池最大连接数 默认8 ,负数表示没有限制
max-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认-1
max-wait: -1
timeout: 30000
eureka:
client:
service-url:
# defaultZone: http://admin:123456@tomcat1:8080/eureka/
defaultZone: http://admin:123456@192.168.4.119:8081/eureka/
# 框架配置
frame:
# 是否开启redis 用户登录若开启此项需要配置redis节点及相关配置若不开启需要注释掉redis相关配置信息
isRedisLogin: true
# 用户登陆超时设置单位为小时此值不能为0
loginTimeout: 4
# 是否开启controller日志监控
showControllerLog: true
# swagger配置
swagger:
# 配置controller包路径
path: com.hcframe.module.**.controller
# 是否开启权限
enableAuth: false
# 用户名
username: admin
# 密码
password: admin
# Druid连接配置
druid:
# Druid用户名
username: test
# Druid密码
password: test
# Druid 允许访问的IP,默认全部允许
# allow: 127.0.0.1
# Druid 拒绝访问的IP,默认不拒绝全部
# deny: 10.0.0.2
feign:
client:
config:
default:
connectTimeout: 300000
readTimeout: 30000
loggerLevel: basic
okhttp:
enabled: true
hystrix:
enabled: true
hcframe:
cas:
casServiceUrl: http://192.168.1.131:8080
serviceUrl: http://192.168.4.130:8084
clientContextPath: /

View File

@@ -1,128 +1,11 @@
server:
port: 8084
#cas:
# server-url-prefix: http://192.168.1.131:8080/cas
# server-login-url: http://192.168.1.131:8080/cas/login
# client-host-url: http://localhost:8084
# validation-type: CAS3
cas:
liu:
client:
casServiceUrl: http://192.168.1.131:8080/cas
serviceUrl: http://localhost:8084
spring:
profiles:
active: dev
application:
name: cloud-gateway
cloud:
nacos:
discovery:
server-addr: 192.168.1.131:8848
namespace: 2e9f0148-751e-4da2-83ec-cb00ffe0d83a
gateway:
discovery:
locator:
# 是否和服务注册与发现组件结合,设置为 true 后可以直接使用应用名称调用服务
enabled: true
routes:
- id: user
uri: lb://cloud-user
predicates:
- Path=/user/**
- id: config
uri: lb://cloud-config
predicates:
- Path=/config/**
datasource:
druid:
# 配置sqlite文件路径需要填写绝对路径推荐将sqlite文件放入到服务器上而非程序jar包或war包中
driver-class-name: org.sqlite.JDBC
url: jdbc:sqlite:/Volumes/DATA/ideaProject/common-frame/hcframe/hcframe-parent/hcframe-config/src/main/resources/datasource.db
# url: jdbc:sqlite:D:/nacos-server-1.4.1/datasource.db
username:
password:
#使用Druid数据源
initialSize: 5
# 初始化大小,最小,最大
minIdle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: select 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat,slf4j
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 若不使用redis需要注释掉此类信息
redis:
database: 0
host: 192.168.100.145
port: 6379
password: root
lettuce:
pool:
# 连接池中的最大空闲连接 默认8
max-idle: 8
# 连接池中的最小空闲连接 默认0
min-idle: 0
# 连接池最大连接数 默认8 ,负数表示没有限制
max-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认-1
max-wait: -1
timeout: 30000
eureka:
client:
service-url:
defaultZone: http://admin:123456@tomcat1:8080/eureka/
# defaultZone: http://admin:123456@192.168.4.119:8081/eureka/
mybatis:
mapper-locations: classpath*:mapping/**/*.xml
type-aliases-package: com.hcframe.**.entity
configuration:
# 开启Sql日志记录
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 框架配置
frame:
# 是否开启redis 用户登录若开启此项需要配置redis节点及相关配置若不开启需要注释掉redis相关配置信息
isRedisLogin: true
# 用户登陆超时设置单位为小时此值不能为0
loginTimeout: 4
# 是否开启controller日志监控
showControllerLog: true
# swagger配置
swagger:
# 配置controller包路径
path: com.hcframe.module.**.controller
# 是否开启权限
enableAuth: false
# 用户名
username: admin
# 密码
password: admin
# Druid连接配置
druid:
# Druid用户名
username: test
# Druid密码
password: test
# Druid 允许访问的IP,默认全部允许
# allow: 127.0.0.1
# Druid 拒绝访问的IP,默认不拒绝全部
# deny: 10.0.0.2
feign:
client:
config:
default:
connectTimeout: 300000
readTimeout: 30000
loggerLevel: basic
okhttp:
enabled: true
hystrix:
enabled: true