Commit 300963ec93ca004c16213693cb2745bff64a20d4
1 parent
e81775d0
Exists in
master
打包build添加
Showing
10 changed files
with
122 additions
and
19 deletions
Show diff stats
cloud/fIle-center/pom.xml
cloud/fIle-center/src/main/resources/application.yml
| ... | ... | @@ -155,15 +155,15 @@ ribbon: |
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | #设置最大容错超时时间 |
| 158 | -hystrix: | |
| 159 | - command: | |
| 160 | - default: | |
| 161 | - execution: | |
| 162 | - timeout: | |
| 163 | - enabled: true | |
| 164 | - isolation: | |
| 165 | - thread: | |
| 166 | - timeoutInMilliseconds: 90000 | |
| 158 | +#hystrix: | |
| 159 | +# command: | |
| 160 | +# default: | |
| 161 | +# execution: | |
| 162 | +# timeout: | |
| 163 | +# enabled: true | |
| 164 | +# isolation: | |
| 165 | +# thread: | |
| 166 | +# timeoutInMilliseconds: 90000 | |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | ... | ... |
cloud/fIle-center/src/main/resources/bootstrap.yml
| ... | ... | @@ -25,7 +25,8 @@ management: |
| 25 | 25 | eureka: |
| 26 | 26 | client: |
| 27 | 27 | serviceUrl: |
| 28 | - defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ | |
| 28 | +# defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ | |
| 29 | + defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/ | |
| 29 | 30 | #http://134.224.249.33:1111/eureka/ 正式库 |
| 30 | 31 | #http://134.224.249.33:1111/eureka/ 测试库 |
| 31 | 32 | #http://127.0.0.1:8761/eureka,http://127.0.0.1:8762/eureka |
| ... | ... | @@ -33,7 +34,8 @@ eureka: |
| 33 | 34 | instance-info-replication-interval-seconds: 10 |
| 34 | 35 | instance: |
| 35 | 36 | prefer-ip-address: true |
| 36 | - instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}} #固定端口 | |
| 37 | + instance-id: ${spring.application.name} | |
| 38 | +# instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}} #固定端口 | |
| 37 | 39 | # instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${randomServerPort.value[5000,5005]}} #随机端口 |
| 38 | 40 | lease-renewal-interval-in-seconds: 10 #每隔几秒告诉eureka服务器我还存活,用于心跳检测 |
| 39 | 41 | lease-expiration-duration-in-seconds: 10 #如果心跳检测一直没有发送,10秒后会从eureka服务器中将此服务剔除 | ... | ... |
cloud/getaway/pom.xml
cloud/getaway/src/main/java/com/sincere/getaway/client/config/PermitUrlProperties.java
| ... | ... | @@ -16,7 +16,7 @@ public class PermitUrlProperties { |
| 16 | 16 | */ |
| 17 | 17 | private static final String[] ENDPOINTS = { |
| 18 | 18 | |
| 19 | - "/v2/api-docs/**", "/swagger-ui.html", "/swagger-resources/**", "/webjars/**" , // api-gateway webflux swagger | |
| 19 | + "/v2/api-docs/**", "/swagger-ui.html","/swagger/index.html", "/swagger-resources/**", "/webjars/**" , // api-gateway webflux swagger | |
| 20 | 20 | "/**/v2/api-docs/**", "/**/swagger-ui.html", "/**/swagger-resources/**", "/**/webjars/**" //业务中心swagger |
| 21 | 21 | }; |
| 22 | 22 | ... | ... |
cloud/getaway/src/main/java/com/sincere/getaway/client/config/SwaggerProvider.java
| ... | ... | @@ -2,6 +2,7 @@ package com.sincere.getaway.client.config; |
| 2 | 2 | |
| 3 | 3 | import lombok.AllArgsConstructor; |
| 4 | 4 | import org.springframework.cloud.gateway.config.GatewayProperties; |
| 5 | +import org.springframework.cloud.gateway.route.RouteDefinition; | |
| 5 | 6 | import org.springframework.cloud.gateway.route.RouteLocator; |
| 6 | 7 | import org.springframework.cloud.gateway.support.NameUtils; |
| 7 | 8 | import org.springframework.context.annotation.Primary; |
| ... | ... | @@ -33,15 +34,19 @@ public class SwaggerProvider implements SwaggerResourcesProvider { |
| 33 | 34 | .filter(predicateDefinition -> ("Path").equalsIgnoreCase(predicateDefinition.getName())) |
| 34 | 35 | .forEach(predicateDefinition -> resources.add(swaggerResource(routeDefinition.getId(), |
| 35 | 36 | predicateDefinition.getArgs().get(NameUtils.GENERATED_NAME_PREFIX + "0") |
| 36 | - .replace("/**", API_URI))))); | |
| 37 | + .replace("/**", API_URI),routeDefinition)))); | |
| 37 | 38 | return resources; |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | - private SwaggerResource swaggerResource(String name, String location) { | |
| 41 | + private SwaggerResource swaggerResource(String name, String location, RouteDefinition routeDefinition) { | |
| 41 | 42 | SwaggerResource swaggerResource = new SwaggerResource(); |
| 42 | 43 | swaggerResource.setName(name); |
| 43 | 44 | swaggerResource.setLocation(location); |
| 44 | 45 | swaggerResource.setSwaggerVersion("2.0"); |
| 46 | +// swaggerResource.setUrl(routeDefinition.getUri().toString()); | |
| 47 | + System.out.println("location:-------------------------------------------"+location); | |
| 48 | + System.out.println("host-----------------------------------------------"+routeDefinition.getUri().toString()); | |
| 49 | + System.out.println("name:-------------------------------------------"+routeDefinition.toString()); | |
| 45 | 50 | return swaggerResource; |
| 46 | 51 | } |
| 47 | 52 | } | ... | ... |
cloud/getaway/src/main/resources/application.yml
| ... | ... | @@ -21,15 +21,35 @@ spring: |
| 21 | 21 | - Path=/usersearch/** |
| 22 | 22 | filters: |
| 23 | 23 | - StripPrefix=1 |
| 24 | - - id: haikangserver | |
| 25 | - uri: lb://haikangserver | |
| 24 | + - id: SmartCampusWebApi | |
| 25 | + uri: http://120.26.116.253:9022 | |
| 26 | +# uri: lb://SmartCampusWebApi | |
| 26 | 27 | predicates: |
| 27 | - - Path=/haikangserver/** | |
| 28 | + - Path=/SmartCampusWebApi/** | |
| 28 | 29 | filters: |
| 29 | 30 | - StripPrefix=1 |
| 30 | 31 | - id: file-center |
| 31 | 32 | uri: lb://file-center |
| 33 | +# uri: http://121.40.30.78:5000 | |
| 32 | 34 | predicates: |
| 33 | 35 | - Path=/file-center/** |
| 34 | 36 | filters: |
| 35 | - - StripPrefix=1 | |
| 36 | 37 | \ No newline at end of file |
| 38 | + - StripPrefix=1 | |
| 39 | +# discovery: | |
| 40 | +# locator: | |
| 41 | +# lowerCaseServiceId: true | |
| 42 | +# enabled: true | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | +#设置最大超时时间 | |
| 47 | +ribbon: | |
| 48 | + httpclient: | |
| 49 | + enabled: false | |
| 50 | + okhttp: | |
| 51 | + enabled: true | |
| 52 | + ReadTimeout: 90000 | |
| 53 | + ConnectTimeout: 90000 | |
| 54 | + OkToRetryOnAllOperations: true | |
| 55 | + MaxAutoRetries: 1 | |
| 56 | + MaxAutoRetriesNextServer: 1 | |
| 37 | 57 | \ No newline at end of file | ... | ... |
cloud/pom.xml
| ... | ... | @@ -113,6 +113,79 @@ |
| 113 | 113 | </dependency> |
| 114 | 114 | </dependencies> |
| 115 | 115 | </dependencyManagement> |
| 116 | + <build> | |
| 117 | + <pluginManagement> | |
| 118 | + <plugins> | |
| 119 | + <plugin> | |
| 120 | + <groupId>org.springframework.boot</groupId> | |
| 121 | + <artifactId>spring-boot-maven-plugin</artifactId> | |
| 122 | + </plugin> | |
| 123 | + <plugin> | |
| 124 | + <artifactId>maven-compiler-plugin</artifactId> | |
| 125 | + <configuration> | |
| 126 | + <target>${java.version}</target> | |
| 127 | + <source>${java.version}</source> | |
| 128 | + <encoding>UTF-8</encoding> | |
| 129 | + </configuration> | |
| 130 | + </plugin> | |
| 131 | + <plugin> | |
| 132 | + <groupId>org.apache.maven.plugins</groupId> | |
| 133 | + <artifactId>maven-jar-plugin</artifactId> | |
| 134 | + <configuration> | |
| 135 | + <archive> | |
| 136 | + <addMavenDescriptor>false</addMavenDescriptor> | |
| 137 | + </archive> | |
| 138 | + </configuration> | |
| 139 | + </plugin> | |
| 140 | + </plugins> | |
| 141 | + </pluginManagement> | |
| 142 | + <resources> | |
| 143 | + <resource> | |
| 144 | + <directory>src/main/resources</directory> | |
| 145 | + <includes> | |
| 146 | + <include>**/*.properties</include> | |
| 147 | + <include>**/*.yml</include> | |
| 148 | + <include>**/*.xml</include> | |
| 149 | + <include>**/*.tld</include> | |
| 150 | + <include>**/*.p12</include> | |
| 151 | + <include>**/*.conf</include> | |
| 152 | + <include>**/*.txt</include> | |
| 153 | + <include>**/*.wsdl</include> | |
| 154 | + <include>**/*.xsd</include> | |
| 155 | + <include>**/*.ftl</include> | |
| 156 | + <include>**/*.lua</include> | |
| 157 | + <include>**/*.json</include> | |
| 158 | + <include>processes/*</include> | |
| 159 | + <include>**/spring.factories</include> | |
| 160 | + </includes> | |
| 161 | + <filtering>false</filtering> | |
| 162 | + </resource> | |
| 163 | + <resource> | |
| 164 | + <directory>src/main/java</directory> | |
| 165 | + <includes> | |
| 166 | + <include>**/*.properties</include> | |
| 167 | + <include>**/*.xml</include> | |
| 168 | + <include>**/*.tld</include> | |
| 169 | + </includes> | |
| 170 | + <filtering>false</filtering> | |
| 171 | + </resource> | |
| 172 | + <resource> | |
| 173 | + <directory>src/main/view</directory> | |
| 174 | + <includes> | |
| 175 | + <include>**/*.*</include> | |
| 176 | + </includes> | |
| 177 | + <filtering>false</filtering> | |
| 178 | + </resource> | |
| 179 | + | |
| 180 | + <resource> | |
| 181 | + <directory>src/main/proto</directory> | |
| 182 | + <includes> | |
| 183 | + <include>**/*.proto</include> | |
| 184 | + </includes> | |
| 185 | + <filtering>false</filtering> | |
| 186 | + </resource> | |
| 187 | + </resources> | |
| 188 | + </build> | |
| 116 | 189 | |
| 117 | 190 | <!-- 形成带第三方jar包的可执行jar包,jar包目录结构如下 application.properties lib META-INF mybatis |
| 118 | 191 | org --> | ... | ... |
cloud/server1/pom.xml