修改:支持jdk17,@PostConstruct 高版本与低版本不兼容

This commit is contained in:
绝尘 2024-04-08 01:10:25 +08:00
parent f4771aadf2
commit 7ce9b4012a
2 changed files with 33 additions and 18 deletions

38
pom.xml
View File

@ -5,49 +5,59 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.tccn</groupId>
<artifactId>zhub-cli</artifactId>
<version>1.0</version>
<artifactId>zhub-client-spring</artifactId>
<version>0.1.3.dev</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.10</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.5.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<!--<version>4.13.1</version>-->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<!--<version>1.18.30</version>-->
<scope>provided</scope>
</dependency>
</dependencies>
<!--<repositories>
<repositories>
<repository>
<id>maven-nexus</id>
<id>maven-release</id>
<name>maven-nexus</name>
<url>http://47.106.237.198:8081/repository/maven-public/</url>
<url>https://nexus.1216.top/repository/maven-public/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>mvn-release</id>
<name>mvn-release</name>
<url>http://47.106.237.198:8081/repository/maven-releases/</url>
<url>https://nexus.1216.top/repository/maven-releases/</url>
</repository>
</distributionManagement>-->
</distributionManagement>
</project>

View File

@ -1,6 +1,8 @@
package tccn.zhub;
import com.google.gson.reflect.TypeToken;
import jakarta.annotation.PostConstruct;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import tccn.AbstractConsumer;
@ -9,7 +11,6 @@ import tccn.IConsumer;
import tccn.IProducer;
import tccn.timer.Timers;
import javax.annotation.PostConstruct;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@ -34,15 +35,16 @@ import java.util.logging.Logger;
public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer {
public Logger logger = Logger.getLogger(ZHubClient.class.getSimpleName());
@Setter
@Value("${zhub.addr}")
private String addr = "127.0.0.1:1216";
@Setter
@Value("${zhub.groupid}")
private String groupid = "";
@Setter
@Value("${zhub.auth}")
private String auth = "";
@Setter
@Value("${zhub.appid}")
protected String appid = "";
@ -70,6 +72,9 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
private boolean isMain = false;*/
private static final Map<String, ZHubClient> mainHub = new HashMap<>(); // 127.0.0.1:1216 - ZHubClient
public ZHubClient() {
}
public ZHubClient(String addr, String groupid, String appid, String auth) {
this.addr = addr;
this.groupid = groupid;