Skip to content

Commit

Permalink
feat: use gson instead of fastjson
Browse files Browse the repository at this point in the history
  • Loading branch information
linyimin0812 committed May 12, 2024
1 parent 6dd178a commit 6de0a9a
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 196 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ endif
.PHONY: package
package: clean install
ifeq ($(strip $(VERSION)),)
${MVN} package
${MVN} package -pl '!coverage-report-aggregate,!spring-startup-cli'
cd ./spring-profiler-extension && ${MVN} package
else
${MVN} package -Drevision=$(VERSION)
${MVN} package -Drevision=$(VERSION) -pl '!coverage-report-aggregate,!spring-startup-cli'
cd ./spring-profiler-extension && ${MVN} package -Drevision=$(VERSION)
endif
mkdir -p ./build && rm -rf ./build/* && cp -r ~/${PROJECT_NAME}/* ./build/ && rm -rf ./build/${PROJECT_NAME}.tar.gz
Expand All @@ -27,17 +27,17 @@ endif
.PHONY: install
install: clean
ifeq ($(strip $(VERSION)),)
${MVN} install
${MVN} install -pl '!coverage-report-aggregate,!spring-startup-cli'
cd ./spring-profiler-extension && ${MVN} install
else
${MVN} install -Drevision=$(VERSION)
${MVN} install -Drevision=$(VERSION) -pl '!coverage-report-aggregate,!spring-startup-cli'
cd ./spring-profiler-extension && ${MVN} install -Drevision=$(VERSION)
endif

.PHONY: deploy
deploy: clean
ifeq ($(strip $(VERSION)),)
${MVN} deploy -pl !coverage-report-aggregate
${MVN} deploy -pl '!coverage-report-aggregate,!spring-startup-cli'
cd ./spring-profiler-extension && ${MVN} deploy
else
${MVN} deploy -Drevision=$(VERSION)
Expand Down
72 changes: 36 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>9</version>
</parent>

<groupId>io.github.linyimin0812</groupId>
<artifactId>spring-startup-analyzer</artifactId>
<packaging>pom</packaging>
<version>${revision}</version>

<name>spring-startup-analyzer</name>

<modules>
<module>spring-profiler-core</module>
<module>spring-profiler-bridge</module>
Expand All @@ -29,11 +29,11 @@
<module>spring-startup-cli</module>
<module>coverage-report-aggregate</module>
</modules>

<url>https://github.com/linyimin5208/spring-startup-analyzer</url>

<description>spring-startup-analyzer</description>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
Expand All @@ -51,7 +51,7 @@
<email>[email protected]</email>
</developer>
</developers>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
Expand All @@ -62,7 +62,7 @@
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -72,90 +72,90 @@
<template.directory>${user.home}/spring-startup-analyzer/template</template.directory>
<sonar.organization>linyimin-bupt</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<revision>3.1.0</revision>
<revision>3.1.1-SNAPSHOT</revision>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/report-aggregate/target/site/
jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<dependencyManagement>
<dependencies>

<dependency>
<groupId>io.github.linyimin0812</groupId>
<artifactId>spring-profiler-common</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.github.linyimin0812</groupId>
<artifactId>spring-async-bean-core</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.github.linyimin0812</groupId>
<artifactId>spring-profiler-bridge</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.github.linyimin0812</groupId>
<artifactId>spring-profiler-api</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.33</version>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>

<dependency>
<groupId>org.picocontainer</groupId>
<artifactId>picocontainer</artifactId>
<version>2.15</version>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.4-M1-groovy-4.0</version>
<scope>test</scope>
</dependency>

</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
Expand All @@ -166,7 +166,7 @@
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
Expand Down Expand Up @@ -200,7 +200,7 @@
</gpgArguments>
</configuration>
</plugin>

<!-- 生成java source.jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -215,7 +215,7 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand All @@ -236,7 +236,7 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
Expand Down Expand Up @@ -267,7 +267,7 @@
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
Expand Down Expand Up @@ -297,10 +297,10 @@
</includes>
</testSource>
</testSources>

</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -346,9 +346,9 @@
</execution>
</executions>
</plugin>

</plugins>

</build>

</project>
15 changes: 7 additions & 8 deletions spring-async-bean-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-async-bean-core</artifactId>
<dependencies>
<dependency>
Expand All @@ -17,23 +17,22 @@
<version>5.2.4.RELEASE</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.github.linyimin0812</groupId>
<artifactId>spring-profiler-common</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.7.11</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -42,7 +41,7 @@
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-spring</artifactId>
Expand All @@ -63,14 +62,14 @@
<version>3.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.19.RELEASE</version>
<scope>test</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,14 @@ public static AsyncBeanProperties parse(Environment environment) {

}

@Override
public String toString() {
return "AsyncBeanProperties{" +
"beanPriorityLoadEnable=" + beanPriorityLoadEnable +
", beanNames=" + beanNames +
", CPU_COUNT=" + CPU_COUNT +
", initBeanThreadPoolCoreSize=" + initBeanThreadPoolCoreSize +
", initBeanThreadPoolMaxSize=" + initBeanThreadPoolMaxSize +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ public boolean isAsyncBean(String beanName) {
return asyncBeanProperties.getBeanNames().contains(beanName);
}

@Override
public String toString() {
return "AsyncConfig{" +
"asyncBeanProperties=" + asyncBeanProperties +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.linyimin0812.async.config

import com.google.gson.Gson
import io.github.linyimin0812.profiler.common.utils.GsonUtil
import org.springframework.core.env.Environment
import org.springframework.core.env.Profiles
import org.springframework.util.StringUtils
Expand Down Expand Up @@ -150,7 +151,7 @@ class AsyncBeanPropertiesSpec extends Specification {
then:
properties.getInitBeanThreadPoolMaxSize() == 100
}

def "test parse default"() {

when:
Expand Down Expand Up @@ -183,7 +184,7 @@ class AsyncBeanPropertiesSpec extends Specification {
@SuppressWarnings("NullableProblems")
private static class CustomEnvironment implements Environment {

private final Gson GSON = new Gson();
private final Gson GSON = GsonUtil.create();

private final Properties properties = new Properties();

Expand Down
Loading

0 comments on commit 6de0a9a

Please sign in to comment.