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

Dev snapshot #88

Merged
merged 34 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8aa9444
feat: 1.2.0-SNAPSHOT
livk-cloud Jul 21, 2023
d5d49ac
feat: 快照版地址调整
livk-cloud Jul 21, 2023
4efb4dc
feat: 移除弃用
livk-cloud Jul 22, 2023
38e06b9
feat: 调整已废弃的类
livk-cloud Jul 22, 2023
311745a
feat: http自动装配调整
livk-cloud Jul 22, 2023
6ad3f44
Merge remote-tracking branch 'origin/main' into dev-snapshot
livk-cloud Aug 25, 2023
d098cf6
feat: http调整
livk-cloud Aug 25, 2023
d910e71
feat: yaml移除
livk-cloud Aug 25, 2023
9ac417d
feat: http configuration
livk-cloud Aug 25, 2023
c93a38f
Merge remote-tracking branch 'origin/main' into dev-snapshot
livk-cloud Sep 22, 2023
d0cd8c2
feat: 调整废弃方法
livk-cloud Sep 22, 2023
4003d88
feat: spring pulsar调整
livk-cloud Sep 22, 2023
eb30b06
Merge remote-tracking branch 'origin/main' into dev-snapshot
livk-cloud Oct 20, 2023
4653478
feat: springboot升级3.2.0-RC1
livk-cloud Oct 21, 2023
c96a9a2
feat: 废弃类或方法改造
livk-cloud Oct 21, 2023
d035ce2
refactor: HttpFactoryBean重构
livk-cloud Oct 21, 2023
cc6002f
Merge branch 'main' into dev-snapshot
livk-cloud Nov 3, 2023
90cd0d8
feat: 升级3.2.0-RC2
livk-cloud Nov 3, 2023
6f2f0b1
Merge remote-tracking branch 'origin/main' into dev-snapshot
livk-cloud Nov 24, 2023
03bad0f
feat: 升级jdk21、springboot3.2.0
livk-cloud Nov 24, 2023
e6be709
feat: 移除废弃方法
livk-cloud Nov 25, 2023
ea2e041
feat: mybatis-spring升级
livk-cloud Nov 25, 2023
b80cdef
feat: jdk21虚拟线程适配
livk-cloud Nov 25, 2023
314ea28
feat: restclient处理
livk-cloud Nov 25, 2023
1eb88b9
docs: javadoc
livk-cloud Nov 25, 2023
aa944ba
feat: 屏蔽javadoc的检查
livk-cloud Nov 25, 2023
c7efc20
fix: http调整、修复factoryBeanObjectType is string
livk-cloud Nov 25, 2023
b73ecfa
fix: 修复factoryBeanObjectType is string
livk-cloud Nov 25, 2023
2324d5f
feat: jdk21废弃方法移除
livk-cloud Nov 25, 2023
78579bb
fix: 修复factoryBeanObjectType问题
livk-cloud Nov 25, 2023
c1ca6c7
fix: kafka test问题修复
livk-cloud Nov 25, 2023
590ac53
style: format
livk-cloud Nov 25, 2023
b53183c
ci: github CI
livk-cloud Nov 25, 2023
bef06fa
ci: 移除github greetings
livk-cloud Nov 25, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ jobs:
run: echo '127.0.0.1 livk.com' | sudo tee -a /etc/hosts

- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/[email protected]
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/greetings.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java=17.0.9-open
java=21-open
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ configure(gradleModuleProjects) {

allprojects {
repositories {
maven("https://repo.spring.io/milestone/")
maven("https://repo.spring.io/release")
maven("https://maven.aliyun.com/repository/public")
maven("https://mirrors.cloud.tencent.com/nexus/repository/maven-public/")
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
}

repositories {
maven("https://repo.spring.io/milestone")
maven("https://repo.spring.io/release")
maven("https://maven.aliyun.com/repository/public")
maven("https://mirrors.cloud.tencent.com/nexus/repository/maven-public/")
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencyResolutionManagement {
}

gradle.settingsEvaluated {
if (JavaVersion.current() < JavaVersion.VERSION_17) {
throw GradleException("This build requires JDK 17. It's currently ${JavaVersion.current()}. You can ignore this check by passing '-Dorg.gradle.ignoreBuildJavaVersionCheck'.")
if (JavaVersion.current() < JavaVersion.VERSION_21) {
throw GradleException("This build requires JDK 21. It's currently ${JavaVersion.current()}. You can ignore this check by passing '-Dorg.gradle.ignoreBuildJavaVersionCheck'.")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.tasks.testing.Test
import org.gradle.external.javadoc.JavadocOutputLevel
import org.gradle.external.javadoc.StandardJavadocDocletOptions

/**
* @author livk
Expand Down Expand Up @@ -52,7 +54,11 @@ abstract class CompileArgsPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.pluginManager.apply(JavaPlugin::class.java)
project.tasks.withType(Javadoc::class.java) { javadoc ->
javadoc.options.encoding(UTF_8)
val options = javadoc.options as StandardJavadocDocletOptions
options.encoding(UTF_8)
javadoc.isFailOnError = false
options.outputLevel = JavadocOutputLevel.QUIET
options.addStringOption("Xdoclint:none", "-quiet")
}
val javaCompile = project.tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME).get() as JavaCompile
addCompile(javaCompile)
Expand Down Expand Up @@ -81,7 +87,7 @@ abstract class CompileArgsPlugin : Plugin<Project> {
private fun addCompile(javaCompile: JavaCompile) {
javaCompile.options.compilerArgs.addAll(COMPILER_ARGS)
javaCompile.options.encoding = UTF_8
javaCompile.sourceCompatibility = JavaVersion.VERSION_17.toString()
javaCompile.targetCompatibility = JavaVersion.VERSION_17.toString()
javaCompile.sourceCompatibility = JavaVersion.VERSION_21.toString()
javaCompile.targetCompatibility = JavaVersion.VERSION_21.toString()
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#project args
group=io.github.livk-cloud
version=1.1.6
version=1.2.0-SNAPSHOT
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=true
Expand Down
6 changes: 2 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
spring-boot = "3.1.6"
spring-boot = "3.2.0"
kotlin = "1.9.21"
pagehelper = "6.0.0"
pagehelper-starter = "2.0.0"
mybatis = "3.5.14"
spring-mybatis = "3.0.2"
spring-mybatis = "3.0.3"
guava = "32.1.3-jre"
easyexcel = "3.3.2"
java-web-socket = "1.5.4"
Expand Down Expand Up @@ -79,7 +79,6 @@ lombok-mapstruct = { group = "org.projectlombok", name = "lombok-mapstruct-bindi
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
easyexcel = { group = "com.alibaba", name = "easyexcel", version.ref = "easyexcel" }
java-webSocket = { group = "org.java-websocket", name = "Java-WebSocket", version.ref = "java-web-socket" }
spring-pulsar-starter = { group = "org.springframework.pulsar", name = "spring-pulsar-spring-boot-starter", version.ref = "spring-pulsar" }
spotbugs-annotations = { group = "com.github.spotbugs", name = "spotbugs-annotations", version.ref = "spotbugs-annotations" }
curator-recipes = { group = "org.apache.curator", name = "curator-recipes", version.ref = "curator" }
ip2region = { group = "org.lionsoul", name = "ip2region", version.ref = "ip2region" }
Expand All @@ -93,7 +92,6 @@ jsqlparser = { group = "com.github.jsqlparser", name = "jsqlparser", version.ref
lettucemod = { group = "com.redis", name = "lettucemod", version.ref = "lettucemod" }
minio = { group = "io.minio", name = "minio", version.ref = "minio" }
dnsjava = { group = "dnsjava", name = "dnsjava", version.ref = "dnsjava" }
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
aliyun-oss = { group = "com.aliyun.oss", name = "aliyun-sdk-oss", version.ref = "aliyun-oss" }
aviator = { group = "com.googlecode.aviator", name = "aviator", version.ref = "aviator" }
protobuf-java = { group = "com.google.protobuf", name = "protobuf-java", version.ref = "protobuf-java" }
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fileTree(rootDir) {
}

gradle.settingsEvaluated {
if (JavaVersion.current() < JavaVersion.VERSION_17) {
throw GradleException("This build requires JDK 17. It's currently ${JavaVersion.current()}. You can ignore this check by passing '-Dorg.gradle.ignoreBuildJavaVersionCheck'.")
if (JavaVersion.current() < JavaVersion.VERSION_21) {
throw GradleException("This build requires JDK 21. It's currently ${JavaVersion.current()}. You can ignore this check by passing '-Dorg.gradle.ignoreBuildJavaVersionCheck'.")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.springframework.core.annotation.Order;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
Expand Down Expand Up @@ -84,18 +85,16 @@ public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity h
OAuth2SmsAuthenticationProvider smsAuthenticationProvider = new OAuth2SmsAuthenticationProvider(
authenticationManager, authorizationService, oAuth2TokenGenerator);

OAuth2AuthorizationServerConfigurer configurer = authorizationServerConfigurer
http.with(authorizationServerConfigurer, configurer -> configurer
.tokenEndpoint((tokenEndpoint) -> tokenEndpoint.accessTokenRequestConverter(accessTokenRequestConverter())
.authenticationProvider(passwordAuthenticationProvider)
.authenticationProvider(smsAuthenticationProvider)
.accessTokenResponseHandler(new AuthenticationSuccessEventHandler())
.errorResponseHandler(new AuthenticationFailureEventHandler()))
.authorizationEndpoint(authorizationEndpoint -> authorizationEndpoint
.consentPage(SecurityConstants.CUSTOM_CONSENT_PAGE_URI));

http.apply(configurer);
http.apply(configurer.authorizationService(authorizationService));
http.apply(new FormIdentityLoginConfigurer());
.consentPage(SecurityConstants.CUSTOM_CONSENT_PAGE_URI))
.authorizationService(authorizationService))
.with(new FormIdentityLoginConfigurer(), Customizer.withDefaults());

RequestMatcher endpointsMatcher = authorizationServerConfigurer.getEndpointsMatcher();
HttpSessionSecurityContextRepository httpSessionSecurityContextRepository = new HttpSessionSecurityContextRepository();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@ public interface KafkaConstant {

String TOPIC = "livk-topic";

String NEW_TOPIC = "livk-new-topic";

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public class KafkaConfig {

@Bean
public KafkaAdmin myKafkaAdmin(KafkaProperties kafkaProperties) {
KafkaAdmin admin = new KafkaAdmin(kafkaProperties.buildAdminProperties());
KafkaAdmin admin = new KafkaAdmin(kafkaProperties.buildAdminProperties(null));
admin.setFatalIfBrokerNotAvailable(true);
return admin;
}

@Bean
public NewTopic myTopic() {
return new NewTopic(KafkaConstant.NEW_TOPIC, 1, (short) 1);
return new NewTopic(KafkaConstant.TOPIC, 1, (short) 1);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ProducerController {
public void producer() {
kafkaTemplate.send(KafkaConstant.TOPIC, UUID.randomUUID().toString());
// 异步获取结果
kafkaTemplate.send(KafkaConstant.NEW_TOPIC, UUID.randomUUID().toString()).whenComplete((result, throwable) -> {
kafkaTemplate.send(KafkaConstant.TOPIC, UUID.randomUUID().toString()).whenComplete((result, throwable) -> {
if (throwable != null) {
log.error("ex:{}", throwable.getMessage());
}
Expand All @@ -53,7 +53,7 @@ public void producer() {
}
});
// 同步获取结果
CompletableFuture<SendResult<Object, Object>> future = kafkaTemplate.send(KafkaConstant.NEW_TOPIC,
CompletableFuture<SendResult<Object, Object>> future = kafkaTemplate.send(KafkaConstant.TOPIC,
UUID.randomUUID().toString());
try {
SendResult<Object, Object> result = future.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package com.livk.kafka.controller;

import com.livk.kafka.KafkaConstant;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
Expand All @@ -32,7 +33,7 @@
* @author livk
*/
@AutoConfigureMockMvc
@SpringBootTest("spring.kafka.bootstrap-servers=localhost:9092")
@SpringBootTest
@EmbeddedKafka(ports = 9092)
class ProducerControllerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static void main(String[] args) {
@GetMapping("home")
public String home() {
log.info("home() has been called");
ExecutorService wrap = ContextSnapshots.wrap(Executors.newFixedThreadPool(2));
ExecutorService wrap = ContextSnapshots.wrap(Executors.newFixedThreadPool(2, Thread.ofVirtual().factory()));
for (int i = 0; i < 3; i++) {
wrap.execute(() -> log.info("home"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/**
* @author livk
*/
@SpringBootTest("spring.kafka.bootstrap-servers=localhost:9092")
@SpringBootTest
@EmbeddedKafka(ports = 9092)
@AutoConfigureMockMvc
class UserControllerTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ plugins {

dependencies {
implementation(project(":spring-boot-example:spring-protobuf-mq:protobuf-commons"))
implementation("org.springframework.pulsar:spring-pulsar-spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-pulsar")
implementation("org.springframework.boot:spring-boot-starter-web")
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ plugins {

dependencies {
api(project(":spring-extension-commons"))
api("org.springframework.pulsar:spring-pulsar-spring-boot-starter")
api("org.springframework.boot:spring-boot-starter-pulsar")
api("org.springframework.boot:spring-boot-autoconfigure")
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @author livk
*/
@SpringBootTest({ "spring.pulsar.client.service-url=pulsar://livk.com:6650", "spring.pulsar.consumer.topics=livk-topic",
"spring.pulsar.consumer.subscription-name=consumer" })
"spring.pulsar.consumer.subscription.name=consumer" })
@AutoConfigureMockMvc
class MessageControllerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ class WebSocketClientTestTest {
void testMain() {
String uri = "ws://127.0.0.1:8888/websocket/";
int threadNum = 1000;
ExecutorService service = Executors.newFixedThreadPool(threadNum);
CountDownLatch countDownLatch = new CountDownLatch(threadNum);
for (int i = 0; i < threadNum; i++) {
String url = uri + "No" + i;
service.submit(new WebSocketClientTest(url, countDownLatch));
countDownLatch.countDown();
try (ExecutorService service = Executors.newFixedThreadPool(threadNum, Thread.ofVirtual().factory())) {
CountDownLatch countDownLatch = new CountDownLatch(threadNum);
for (int i = 0; i < threadNum; i++) {
String url = uri + "No" + i;
service.submit(new WebSocketClientTest(url, countDownLatch));
countDownLatch.countDown();
}
assertEquals(0, countDownLatch.getCount());
}
assertEquals(0, countDownLatch.getCount());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,23 @@ class LockControllerTest {

@Test
void lock() throws InterruptedException {
ExecutorService service = Executors.newFixedThreadPool(10);
CountDownLatch countDownLatch = new CountDownLatch(10);
for (int i = 0; i < 10; i++) {
String param = String.valueOf(i);
service.submit(() -> {
try {
mockMvc.perform(get("/lock").queryParam("id", param)).andExpect(status().isOk());
countDownLatch.countDown();
}
catch (Exception e) {
throw new RuntimeException(e);
}
});
try (ExecutorService service = Executors.newFixedThreadPool(10, Thread.ofVirtual().factory())) {
CountDownLatch countDownLatch = new CountDownLatch(10);
for (int i = 0; i < 10; i++) {
String param = String.valueOf(i);
service.submit(() -> {
try {
mockMvc.perform(get("/lock").queryParam("id", param)).andExpect(status().isOk());
countDownLatch.countDown();
}
catch (Exception e) {
throw new RuntimeException(e);
}
});
}
countDownLatch.await();
service.shutdown();
}
countDownLatch.await();
service.shutdown();
}

}
Loading