正在显示
9 个修改的文件
包含
45 行增加
和
48 行删除
| @@ -10,7 +10,7 @@ spring: | @@ -10,7 +10,7 @@ spring: | ||
| 10 | devtools: | 10 | devtools: |
| 11 | add-properties: false | 11 | add-properties: false |
| 12 | profiles: | 12 | profiles: |
| 13 | - active: dev | 13 | + active: prd |
| 14 | mvc: | 14 | mvc: |
| 15 | #静态资源,设置上传文件的访问, | 15 | #静态资源,设置上传文件的访问, |
| 16 | static-path-pattern: /** | 16 | static-path-pattern: /** |
| @@ -51,7 +51,7 @@ spring: | @@ -51,7 +51,7 @@ spring: | ||
| 51 | enabled: true | 51 | enabled: true |
| 52 | 52 | ||
| 53 | datasource: | 53 | datasource: |
| 54 | - type: com.alibaba.druid.pool.DruidDataSource | 54 | + type: com.zaxxer.hikari.HikariDataSource |
| 55 | #oracle | 55 | #oracle |
| 56 | #driver-class-name=oracle.jdbc.OracleDriver | 56 | #driver-class-name=oracle.jdbc.OracleDriver |
| 57 | #url=jdbc:oracle:thin:@10.50.3.68:1521:CGODW | 57 | #url=jdbc:oracle:thin:@10.50.3.68:1521:CGODW |
| @@ -62,30 +62,26 @@ spring: | @@ -62,30 +62,26 @@ spring: | ||
| 62 | username: 110 | 62 | username: 110 |
| 63 | password: QAHqCJf2kFYCLirM | 63 | password: QAHqCJf2kFYCLirM |
| 64 | driver-class-name: com.mysql.cj.jdbc.Driver | 64 | driver-class-name: com.mysql.cj.jdbc.Driver |
| 65 | - #配置初始化大小/最小/最大 | ||
| 66 | - druid: | ||
| 67 | - initial-size: 1 | ||
| 68 | - min-idle: 1 | ||
| 69 | - max-active: 20 | ||
| 70 | - #获取连接等待超时时间 | ||
| 71 | - max-wait: 60000 | ||
| 72 | - #一个连接在池中最小生存的时间 | ||
| 73 | - min-evictable-idle-time-millis: 300000 | ||
| 74 | - #间隔多久进行一次检测,检测需要关闭的空闲连接 | ||
| 75 | - time-between-eviction-runs-millis: 60000 | ||
| 76 | - #mysql | ||
| 77 | - validation-query: SELECT 1 FROM DUAL | ||
| 78 | - #oracle | ||
| 79 | - #druid.validation-query:SELECT 'x' FROM DUAL | ||
| 80 | - test-while-idle: true | ||
| 81 | - test-on-borrow: false | ||
| 82 | - test-on-return: false | ||
| 83 | - default-auto-commit: true | ||
| 84 | -# tomcat: | ||
| 85 | -# max-wait: 10 | ||
| 86 | -# max-idle: 10000 | ||
| 87 | -# min-idle: 5 | ||
| 88 | -# initial-size: 5 | 65 | + # HikariCP特有配置 |
| 66 | + hikari: | ||
| 67 | + # 连接池名称 | ||
| 68 | + pool-name: KakoUserHikariCP- | ||
| 69 | + # 最小空闲连接数 | ||
| 70 | + minimum-idle: 1 | ||
| 71 | + # 最大连接数 | ||
| 72 | + maximum-pool-size: 20 | ||
| 73 | + # 连接超时时间(毫秒) | ||
| 74 | + connection-timeout: 60000 | ||
| 75 | + # 空闲连接超时时间(毫秒) | ||
| 76 | + idle-timeout: 300000 | ||
| 77 | + # 连接测试超时时间 | ||
| 78 | + validation-timeout: 3000 | ||
| 79 | + # 连接最大生命周期 | ||
| 80 | + max-lifetime: 1800000 | ||
| 81 | + # 连接测试查询 | ||
| 82 | + connection-test-query: SELECT 1 | ||
| 83 | + # 初始化连接数 | ||
| 84 | + initialization-fail-timeout: 1 | ||
| 89 | 85 | ||
| 90 | eureka: | 86 | eureka: |
| 91 | instance: | 87 | instance: |
| @@ -96,11 +92,7 @@ eureka: | @@ -96,11 +92,7 @@ eureka: | ||
| 96 | hostname: ${spring.cloud.client.ip-address} | 92 | hostname: ${spring.cloud.client.ip-address} |
| 97 | lease-renewal-interval-in-seconds: 15 | 93 | lease-renewal-interval-in-seconds: 15 |
| 98 | lease-expiration-duration-in-seconds: 45 | 94 | lease-expiration-duration-in-seconds: 45 |
| 99 | - health-check-url-path: /actuator/health | ||
| 100 | - metadata-map: | ||
| 101 | - user: | ||
| 102 | - name: "admin" #These two are needed so that the server | ||
| 103 | - password: "123456" | 95 | + health-check-url-path: /ac/health |
| 104 | client: | 96 | client: |
| 105 | #eureka注册中心服务器地址 | 97 | #eureka注册中心服务器地址 |
| 106 | service-url: | 98 | service-url: |
| @@ -108,19 +100,27 @@ eureka: | @@ -108,19 +100,27 @@ eureka: | ||
| 108 | defaultZone: http://192.168.1.53:12345/eureka/ | 100 | defaultZone: http://192.168.1.53:12345/eureka/ |
| 109 | registry-fetch-interval-seconds: 30 | 101 | registry-fetch-interval-seconds: 30 |
| 110 | 102 | ||
| 111 | - | ||
| 112 | - | ||
| 113 | management: | 103 | management: |
| 114 | endpoints: | 104 | endpoints: |
| 115 | enabled-by-default: true | 105 | enabled-by-default: true |
| 116 | web: | 106 | web: |
| 107 | + base-path: /ac # 端点路径更改为 /ac | ||
| 117 | exposure: | 108 | exposure: |
| 118 | - include: "*" | 109 | + include: "health,info" # 仅暴露必要端点 |
| 119 | endpoint: | 110 | endpoint: |
| 120 | health: | 111 | health: |
| 121 | - show-details: always | 112 | + show-details: never # 不显示详细健康信息 |
| 122 | shutdown: | 113 | shutdown: |
| 123 | - enabled: true | 114 | + enabled: false # 禁用关闭端点 |
| 115 | + env: | ||
| 116 | + enabled: false # 禁用环境端点(防止敏感信息泄露) | ||
| 117 | + mappings: | ||
| 118 | + enabled: false # 禁用映射端点(防止接口路径泄露) | ||
| 119 | + beans: | ||
| 120 | + enabled: false # 禁用beans端点 | ||
| 121 | + configprops: | ||
| 122 | + enabled: false # 禁用configprops端点 | ||
| 123 | + | ||
| 124 | 124 | ||
| 125 | mybatis: | 125 | mybatis: |
| 126 | mapper-locations: classpath:mapping/*.xml | 126 | mapper-locations: classpath:mapping/*.xml |
| @@ -184,7 +184,7 @@ | @@ -184,7 +184,7 @@ | ||
| 184 | </springProfile> | 184 | </springProfile> |
| 185 | 185 | ||
| 186 | <!--生产环境:输出到文件--> | 186 | <!--生产环境:输出到文件--> |
| 187 | - <springProfile name="pro"> | 187 | + <springProfile name="prd"> |
| 188 | <root level="info"> | 188 | <root level="info"> |
| 189 | <appender-ref ref="CONSOLE" /> | 189 | <appender-ref ref="CONSOLE" /> |
| 190 | <appender-ref ref="DEBUG_FILE" /> | 190 | <appender-ref ref="DEBUG_FILE" /> |
| @@ -169,12 +169,6 @@ | @@ -169,12 +169,6 @@ | ||
| 169 | <version>${fastjson_version}</version> | 169 | <version>${fastjson_version}</version> |
| 170 | </dependency> | 170 | </dependency> |
| 171 | <!-- tools--> | 171 | <!-- tools--> |
| 172 | - <!-- alibaba的druid数据库连接池 --> | ||
| 173 | - <dependency> | ||
| 174 | - <groupId>com.alibaba</groupId> | ||
| 175 | - <artifactId>druid-spring-boot-starter</artifactId> | ||
| 176 | - <version>1.1.9</version> | ||
| 177 | - </dependency> | ||
| 178 | <!-- mysql--> | 172 | <!-- mysql--> |
| 179 | <dependency> | 173 | <dependency> |
| 180 | <groupId>mysql</groupId> | 174 | <groupId>mysql</groupId> |
| @@ -2,6 +2,7 @@ package com.tianbo.warehouse; | @@ -2,6 +2,7 @@ package com.tianbo.warehouse; | ||
| 2 | 2 | ||
| 3 | import org.springframework.context.annotation.Bean; | 3 | import org.springframework.context.annotation.Bean; |
| 4 | import org.springframework.context.annotation.Configuration; | 4 | import org.springframework.context.annotation.Configuration; |
| 5 | +import org.springframework.context.annotation.Profile; | ||
| 5 | import springfox.documentation.builders.ApiInfoBuilder; | 6 | import springfox.documentation.builders.ApiInfoBuilder; |
| 6 | import springfox.documentation.builders.PathSelectors; | 7 | import springfox.documentation.builders.PathSelectors; |
| 7 | import springfox.documentation.builders.RequestHandlerSelectors; | 8 | import springfox.documentation.builders.RequestHandlerSelectors; |
| @@ -13,6 +14,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | @@ -13,6 +14,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 13 | 14 | ||
| 14 | @Configuration | 15 | @Configuration |
| 15 | @EnableSwagger2 | 16 | @EnableSwagger2 |
| 17 | +@Profile({"dev", "test"}) // 只在dev和test环境启用 | ||
| 16 | public class Swagger2 { | 18 | public class Swagger2 { |
| 17 | //swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等 | 19 | //swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等 |
| 18 | @Bean | 20 | @Bean |
| 1 | package com.tianbo.warehouse.annotation.cache.util.redis; | 1 | package com.tianbo.warehouse.annotation.cache.util.redis; |
| 2 | 2 | ||
| 3 | -import com.alibaba.druid.util.StringUtils; | 3 | + |
| 4 | import lombok.extern.slf4j.Slf4j; | 4 | import lombok.extern.slf4j.Slf4j; |
| 5 | 5 | ||
| 6 | import org.aspectj.lang.ProceedingJoinPoint; | 6 | import org.aspectj.lang.ProceedingJoinPoint; |
| @@ -10,6 +10,7 @@ import org.springframework.expression.EvaluationContext; | @@ -10,6 +10,7 @@ import org.springframework.expression.EvaluationContext; | ||
| 10 | import org.springframework.expression.spel.standard.SpelExpressionParser; | 10 | import org.springframework.expression.spel.standard.SpelExpressionParser; |
| 11 | import org.springframework.expression.spel.support.StandardEvaluationContext; | 11 | import org.springframework.expression.spel.support.StandardEvaluationContext; |
| 12 | import org.springframework.stereotype.Component; | 12 | import org.springframework.stereotype.Component; |
| 13 | +import org.springframework.util.StringUtils; | ||
| 13 | 14 | ||
| 14 | import java.util.Arrays; | 15 | import java.util.Arrays; |
| 15 | 16 |
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> | 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> |
| 20 | <div class="container"> | 20 | <div class="container"> |
| 21 | <div class="navbar-header"> | 21 | <div class="navbar-header"> |
| 22 | - <a class="navbar-brand" href="#">Spring Security演示</a> | 22 | + <a class="navbar-brand" href="#">u have no rights</a> |
| 23 | </div> | 23 | </div> |
| 24 | <div id="navbar" class="collapse navbar-collapse"> | 24 | <div id="navbar" class="collapse navbar-collapse"> |
| 25 | <ul class="nav navbar-nav"> | 25 | <ul class="nav navbar-nav"> |
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> | 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> |
| 20 | <div class="container"> | 20 | <div class="container"> |
| 21 | <div class="navbar-header"> | 21 | <div class="navbar-header"> |
| 22 | - <a class="navbar-brand" href="#">Spring Security演示</a> | 22 | + <a class="navbar-brand" href="#">user center</a> |
| 23 | </div> | 23 | </div> |
| 24 | <div id="navbar" class="collapse navbar-collapse"> | 24 | <div id="navbar" class="collapse navbar-collapse"> |
| 25 | <ul class="nav navbar-nav"> | 25 | <ul class="nav navbar-nav"> |
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> | 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> |
| 20 | <div class="container"> | 20 | <div class="container"> |
| 21 | <div class="navbar-header"> | 21 | <div class="navbar-header"> |
| 22 | - <a class="navbar-brand" href="#">Spring Security演示</a> | 22 | + <a class="navbar-brand" href="#">user center</a> |
| 23 | </div> | 23 | </div> |
| 24 | <div id="navbar" class="collapse navbar-collapse"> | 24 | <div id="navbar" class="collapse navbar-collapse"> |
| 25 | <ul class="nav navbar-nav"> | 25 | <ul class="nav navbar-nav"> |
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> | 19 | <nav class="navbar navbar-inverse navbar-fixed-top"> |
| 20 | <div class="container"> | 20 | <div class="container"> |
| 21 | <div class="navbar-header"> | 21 | <div class="navbar-header"> |
| 22 | - <a class="navbar-brand" href="#">Spring Security演示</a> | 22 | + <a class="navbar-brand" href="#">user center</a> |
| 23 | </div> | 23 | </div> |
| 24 | <div id="navbar" class="collapse navbar-collapse"> | 24 | <div id="navbar" class="collapse navbar-collapse"> |
| 25 | <ul class="nav navbar-nav"> | 25 | <ul class="nav navbar-nav"> |
-
请 注册 或 登录 后发表评论