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

Draft: Upgrade to jdk 17 and SpringBoot 3.x #217

Merged
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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This source code is licensed under Apache 2.0 License.
- [x] Duration

## Dependencies upgrade
- [ ] Springboot 3.x support.
- [x] Springboot 3.x support.

# NEXT
## Dependencies upgrade
Expand Down Expand Up @@ -82,6 +82,11 @@ This source code is licensed under Apache 2.0 License.
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
```

# 1.1.6
## Dependencies
- Upgrade to `JDK 17` and SpringBoot `3.x`.


# 1.1.5
## Bugfix
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Version base
You should be having:
- JDK >= 8
- JDK >= 17
- NebulaGraph > v3.0
- Springboot 2.x
- Springboot 3.x
- Maven

## Clone the repository
Expand Down
2 changes: 1 addition & 1 deletion ngbatis-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<version>3.0.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.nebula-contrib</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
//
// This source code is licensed under Apache 2.0 License.

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import jakarta.persistence.Column;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;

/**
* 列别名测试用例-实体类
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
//
// This source code is licensed under Apache 2.0 License.

import javax.persistence.Table;
import org.nebula.contrib.ngbatis.annotations.Space;

import jakarta.persistence.Table;

/**
* @author yeweicheng
* @since 2023-01-12 13:20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// This source code is licensed under Apache 2.0 License.

import javax.persistence.Table;
import jakarta.persistence.Table;

/**
* <p>关系实体类示例。</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
// This source code is licensed under Apache 2.0 License.

import javax.persistence.Id;
import javax.persistence.Table;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

/**
* <p>关系实体类示例。</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
//
// This source code is licensed under Apache 2.0 License.

import javax.persistence.Id;
import javax.persistence.Table;
import org.nebula.contrib.ngbatis.annotations.Space;

import jakarta.persistence.Id;
import jakarta.persistence.Table;

/**
* @author yeweicheng
* @since 2023-08-02 18:35
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
//
// This source code is licensed under Apache 2.0 License.

import ye.weicheng.ngbatis.demo.annotations.ValueType;

import jakarta.persistence.Id;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Id;
import javax.persistence.Table;
import ye.weicheng.ngbatis.demo.annotations.ValueType;

/**
* <p>Person的实体类示例</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
//
// This source code is licensed under Apache 2.0 License.

import jakarta.persistence.Column;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.sql.Time;
import java.sql.Timestamp;
import java.time.Duration;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;

/**
* @author yeweicheng
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
// This source code is licensed under Apache 2.0 License.

import com.vesoft.nebula.client.graph.data.ResultSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.Id;
import org.nebula.contrib.ngbatis.models.data.NgEdge;
import org.nebula.contrib.ngbatis.models.data.NgSubgraph;
import org.nebula.contrib.ngbatis.models.data.NgVertex;
Expand All @@ -18,6 +14,11 @@
import ye.weicheng.ngbatis.demo.pojo.Person;
import ye.weicheng.ngbatis.demo.pojo.PersonLikePerson;

import jakarta.persistence.Id;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* 数据访问层 样例。
*<p/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
//
// This source code is licensed under Apache 2.0 License.

import javax.annotation.Resource;
import org.nebula.contrib.ngbatis.proxy.NebulaDaoBasic;
import ye.weicheng.ngbatis.demo.pojo.Person;

import jakarta.annotation.Resource;

/**
* 数据访问层 样例。
*<p/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
// This source code is licensed under Apache 2.0 License.

import com.alibaba.fastjson.JSON;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Random;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
Expand All @@ -19,6 +14,12 @@
import org.springframework.boot.test.context.SpringBootTest;
import ye.weicheng.ngbatis.demo.pojo.Employee;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Random;

/**
* Multi tags tests.
* @author yeweicheng
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
//
// This source code is licensed under Apache 2.0 License.

import static org.springframework.util.Assert.isTrue;

import java.util.Objects;
import javax.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import ye.weicheng.ngbatis.demo.repository.TestRepository;

import jakarta.annotation.Resource;
import java.util.Objects;

import static org.springframework.util.Assert.isTrue;

/**
* @author yeweicheng
* @since 2023-08-04 17:48
Expand Down
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<version>3.0.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<name>ngbatis</name>
Expand Down Expand Up @@ -74,16 +74,30 @@
<artifactId>asm</artifactId>
<version>8.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.15.3</version>
</dependency>

<!-- Beetl project -->
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl-spring-jdk17</artifactId>
<version>3.15.8.RELEASE</version>
</dependency>

<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
<version>3.1.8.RELEASE</version>
<artifactId>beetl-springboot-starter-jdk17</artifactId>
<version>3.15.8.RELEASE</version>
</dependency>

<!-- for nGQL escape in xml -->
Expand Down Expand Up @@ -168,6 +182,7 @@
<version>3.2.0</version>
<configuration>
<excludePackageNames>com.facebook.thrift:com.facebook.thrift.*</excludePackageNames>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.net.UnknownHostException;
import java.util.Collection;
import java.util.Map;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import org.nebula.contrib.ngbatis.config.NebulaJdbcProperties;
import org.nebula.contrib.ngbatis.config.NgbatisConfig;
import org.nebula.contrib.ngbatis.config.ParseCfgProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import org.nebula.contrib.ngbatis.ArgsResolver;
import org.nebula.contrib.ngbatis.models.MethodModel;
import org.nebula.contrib.ngbatis.utils.ReflectUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// This source code is licensed under Apache 2.0 License.

import javax.annotation.PreDestroy;
import jakarta.annotation.PreDestroy;
import org.nebula.contrib.ngbatis.ArgNameFormatter;
import org.nebula.contrib.ngbatis.ArgsResolver;
import org.nebula.contrib.ngbatis.Env;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
import static org.nebula.contrib.ngbatis.proxy.NebulaDaoBasicExt.proxy;
import static org.nebula.contrib.ngbatis.proxy.NebulaDaoBasicExt.vertexName;

import com.sun.istack.NotNull;
import com.vesoft.nebula.client.graph.data.ResultSet;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.jetbrains.annotations.NotNull;
import org.nebula.contrib.ngbatis.exception.QueryException;
import org.nebula.contrib.ngbatis.models.ClassModel;
import org.nebula.contrib.ngbatis.models.MethodModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Map;
import javax.persistence.Table;
import jakarta.persistence.Table;
import org.nebula.contrib.ngbatis.models.ClassModel;
import org.nebula.contrib.ngbatis.models.MapperContext;
import org.nebula.contrib.ngbatis.models.MethodModel;
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/org/nebula/contrib/ngbatis/utils/ReflectUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import jakarta.persistence.Column;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import org.nebula.contrib.ngbatis.exception.ParseException;
import org.nebula.contrib.ngbatis.models.MethodModel;
import org.springframework.util.Assert;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;

import java.lang.reflect.ParameterizedType;
/**
* <p>反射工具类。</p>
*
Expand Down Expand Up @@ -431,9 +430,9 @@ public static Class<?> typeArg(Object o, Class<?> parent, int i) {
if (parent.isInterface()) {
Type[] interfaces = insClass.getGenericInterfaces();
for (Type anInterface : interfaces) {
boolean isType = anInterface instanceof ParameterizedTypeImpl;
boolean isType = anInterface instanceof ParameterizedType;
if (isType) {
ParameterizedTypeImpl paramTypeInterface = (ParameterizedTypeImpl) anInterface;
ParameterizedType paramTypeInterface = (ParameterizedType) anInterface;
boolean found = paramTypeInterface.getRawType() == parent;
if (found) {
Type[] actualTypeArguments = paramTypeInterface.getActualTypeArguments();
Expand All @@ -455,8 +454,8 @@ public static Class<?> typeArg(Object o, Class<?> parent, int i) {
* when type is not ParameterizedTypeImpl and the type name can not get class object in jvm.
*/
public static Class<?> typeToClass(Type type) throws ClassNotFoundException {
if (type instanceof ParameterizedTypeImpl) {
return ((ParameterizedTypeImpl) type).getRawType();
if (type instanceof ParameterizedType) {
return ((ParameterizedType) type).getRawType().getClass();
}
return Class.forName(type.getTypeName());
}
Expand Down