v0.0.3
All checks were successful
CI/CD / build-deploy (pull_request) Successful in 13s

This commit is contained in:
Timi
2026-02-10 18:55:53 +08:00
parent d2d904fe53
commit 13ae5016e8
4 changed files with 22 additions and 1 deletions

View File

@ -13,10 +13,11 @@
<groupId>com.imyeyu.spring</groupId>
<artifactId>timi-spring</artifactId>
<version>0.0.2</version>
<version>0.0.3</version>
<packaging>jar</packaging>
<properties>
<java.version>21</java.version>
<springboot.version>3.4.0</springboot.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>

View File

@ -14,9 +14,12 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
@ -491,4 +494,17 @@ public class TimiSpring {
}
return new RequestRange(start, end);
}
public static void copyPropertiesNotNull(Object source, Object target) {
BeanWrapper srcBean = new BeanWrapperImpl(source);
BeanWrapper targetBean = new BeanWrapperImpl(target);
for (PropertyDescriptor pd : srcBean.getPropertyDescriptors()) {
String propertyName = pd.getName();
Object srcValue = srcBean.getPropertyValue(propertyName);
if (srcValue != null && targetBean.isWritableProperty(propertyName)) {
targetBean.setPropertyValue(propertyName, srcValue);
}
}
}
}

View File

@ -11,10 +11,12 @@ import java.lang.annotation.Target;
*
* @author 夜雨
* @version 2023-08-09 10:36
* @deprecated 0.0.3 过时0.0.5 移除,单参数建议 url 传参
*/
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Deprecated
public @interface RequestSingleParam {
}

View File

@ -20,8 +20,10 @@ import org.springframework.web.method.support.ModelAndViewContainer;
*
* @author 夜雨
* @since 2025-10-13 16:29
* @deprecated 0.0.3 过时0.0.5 移除,单参数建议 url 传参
*/
@Component
@Deprecated
public class RequestSingleParamResolver implements HandlerMethodArgumentResolver {
/**