Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update Springboot maven version to 2.5.14 #9

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions hango-api-plane-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,26 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>

<dependency>
Expand All @@ -64,7 +59,12 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.3.6.Final</version>
</dependency>

<!-- https://mvnrepository.com/artifact/commons-net/commons-net -->
Expand All @@ -84,7 +84,6 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1.1</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
Expand Down Expand Up @@ -142,7 +141,6 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.4.0</version>
</dependency>

<dependency>
Expand All @@ -161,7 +159,7 @@
<dependency>
<groupId>net.devh</groupId>
<artifactId>grpc-server-spring-boot-starter</artifactId>
<version>1.4.0.RELEASE</version>
<version>2.13.1.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.reflections/reflections -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableAsync;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.InterceptingClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.util.ResourceUtils;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.time.Duration;
import java.util.List;


Expand All @@ -46,7 +49,7 @@ RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {

return restTemplateBuilder
.interceptors(interceptors)
.requestFactory(new InterceptingClientHttpRequestFactory(
.requestFactory(() -> new InterceptingClientHttpRequestFactory(
new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()), interceptors))
.build();
}
Expand All @@ -57,9 +60,9 @@ RestTemplate shortTimeoutRestTemplate(RestTemplateBuilder restTemplateBuilder) {
List<ClientHttpRequestInterceptor> interceptors = ImmutableList.of(new RestTemplateLogInterceptor());

return restTemplateBuilder
.setConnectTimeout(1000)
.setConnectTimeout(Duration.ofSeconds(1))
.interceptors(interceptors)
.requestFactory(new InterceptingClientHttpRequestFactory(
.requestFactory(() -> new InterceptingClientHttpRequestFactory(
new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()), interceptors))
.build();
}
Expand Down Expand Up @@ -88,7 +91,8 @@ ObjectMapper jsonObjectMapper() {
}

@PostConstruct
void configureFreemarkerConfig() {
void configureFreemarkerConfig() throws IOException {
freemarkerConfig.setDirectoryForTemplateLoading(ResourceUtils.getFile("classpath:template"));
freemarkerConfig.setNumberFormat("#");
freemarkerConfig.setSharedVariable("indent", new IndentationDirective());
freemarkerConfig.setSharedVariable("ignore", new IgnoreDirective());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hango.cloud.configuration.env;

import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
import org.hango.cloud.configuration.ext.K8sMultiClusterProperties;
import org.hango.cloud.core.GlobalConfig;
import org.hango.cloud.core.editor.EditorContext;
Expand Down Expand Up @@ -36,7 +37,6 @@
import org.hango.cloud.service.GatewayService;
import org.hango.cloud.service.impl.GatewayServiceImpl;
import io.grpc.Server;
import io.grpc.netty.NettyServerBuilder;
import istio.mcp.nsf.SnapshotOuterClass;
import istio.mcp.v1alpha1.Mcp;
import istio.mcp.v1alpha1.ResourceOuterClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package org.hango.cloud.configuration.ext;

import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.DefaultPropertySourceFactory;
import org.springframework.core.io.support.EncodedResource;

import java.io.IOException;
import java.util.Properties;

public class YamlPropertyLoaderFactory extends DefaultPropertySourceFactory {
@Override
public org.springframework.core.env.PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
return new YamlPropertySourceLoader().load(resource.getResource().getFilename(), resource.getResource(), null);
public PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resource.getResource());
Properties properties = factory.getObject();
return new PropertiesPropertySource(resource.getResource().getFilename(), properties);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.hango.cloud.configuration.mode;

import net.devh.boot.grpc.server.serverfactory.GrpcServerLifecycle;
import org.hango.cloud.configuration.ApiPlaneAutoBaseConfiguration;
import net.devh.springboot.autoconfigure.grpc.server.GrpcServerLifecycle;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public RlsClusterClient(McpOptions mcpOptions, ResourceDao resourceDao, McpMarsh
for (String address : mcpOptions.getRegisteredRlsCluster()) {
String[] hostPort = StringUtils.split(address, ":");
if (hostPort.length == 2) {
ManagedChannel channel = ManagedChannelBuilder.forAddress(hostPort[0], Integer.parseInt(hostPort[1])).usePlaintext(true).build();
ManagedChannel channel = ManagedChannelBuilder.forAddress(hostPort[0], Integer.parseInt(hostPort[1])).usePlaintext().build();
stubs.add(RatelimitConfigServiceGrpc.newStub(channel));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void execute(Environment environment, Map parameters, TemplateModel[] loo
gen.createOrUpdateValue("$[?]", "name", Keyword.API.replacement, Criteria.where("name").exists(false));

String yaml = gen.yamlString();
yaml = yaml.replaceAll("(?m)^(-?\\s*)nsf-template-.*?:(?:\\s*)(<.*>)", "$1$2");
yaml = yaml.replaceAll("(?m)^(-?\\s*)nsf-template-.*?:(?:\\s*)\"(<.*>)\"", "$1$2");

environment.getOut().write(yaml);
writer.close();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.hango.cloud.core;

import net.devh.springboot.autoconfigure.grpc.server.GrpcServerLifecycle;
import net.devh.boot.grpc.server.serverfactory.GrpcServerLifecycle;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>java</sonar.language>
</properties>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.14</version>
</parent>

<modules>
<module>hango-proto</module>
<module>hango-api-plane-server</module>
Expand Down