mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-29 12:34:28 +08:00
(improvement)(headless | chat | common | launcher) springboot3 upgrade
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
<artifactId>launchers-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -46,4 +46,4 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.tencent.supersonic.config;
|
||||
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.LaxRedirectStrategy;
|
||||
|
||||
|
||||
import org.apache.hc.client5.http.impl.DefaultRedirectStrategy;
|
||||
//import org.apache.hc.client5.http.impl.LaxRedirectStrategy;
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
@@ -16,14 +19,18 @@ public class RestTemplateConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
|
||||
// HttpClient 5 较新版本才会有LaxRedirectStrategy, 所以我重新定义了
|
||||
CloseableHttpClient httpClient =
|
||||
HttpClientBuilder.create().setRedirectStrategy(new DefaultRedirectStrategy()) // 使用宽松重定向策略
|
||||
//HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()) // 使用宽松重定向策略
|
||||
.build();
|
||||
|
||||
HttpComponentsClientHttpRequestFactory httpRequestFactory =
|
||||
new HttpComponentsClientHttpRequestFactory();
|
||||
new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||
httpRequestFactory.setConnectionRequestTimeout(2000);
|
||||
httpRequestFactory.setConnectTimeout(10000);
|
||||
httpRequestFactory.setReadTimeout(7200000);
|
||||
HttpClient httpClient =
|
||||
HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build();
|
||||
httpRequestFactory.setHttpClient(httpClient);
|
||||
|
||||
RestTemplate restTemplate = new RestTemplate(httpRequestFactory);
|
||||
restTemplate.getMessageConverters().set(1,
|
||||
new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||
|
||||
@@ -3,14 +3,15 @@ package com.tencent.supersonic.web;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig extends WebMvcConfigurerAdapter {
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/webapp/**").addResourceLocations("classpath:/webapp/");
|
||||
registry.addResourceHandler("/webapp/**")
|
||||
.addResourceLocations("classpath:/webapp/");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user