[~] @NonNull

This commit is contained in:
acgist
2025-04-21 09:33:53 +08:00
parent 40149bc496
commit 811a57a27b
26 changed files with 57 additions and 29 deletions

View File

@@ -6,6 +6,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.lang.NonNull;
import org.springframework.util.AntPathMatcher;
import com.acgist.taoyao.boot.config.SecurityProperties;
@@ -63,7 +64,7 @@ public class SecurityInterceptor extends InterceptorAdapter {
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception {
if(this.permit(request) || this.authorization(request)) {
return true;
}

View File

@@ -1,5 +1,8 @@
package com.acgist.taoyao.interceptor;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import com.acgist.taoyao.boot.config.TaoyaoProperties;
import com.acgist.taoyao.boot.interceptor.InterceptorAdapter;
@@ -43,13 +46,13 @@ public class SlowInterceptor extends InterceptorAdapter {
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception {
this.local.set(System.currentTimeMillis());
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception e) throws Exception {
public void afterCompletion(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler, @Nullable Exception e) throws Exception {
final long duration = System.currentTimeMillis() - this.local.get();
if(duration > this.taoyaoProperties.getTimeout()) {
log.info("请求执行时间过慢:{} - {}", request.getRequestURI(), duration);

View File

@@ -2,6 +2,7 @@ package com.acgist.taoyao.listener;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import lombok.extern.slf4j.Slf4j;
@@ -17,7 +18,7 @@ import lombok.extern.slf4j.Slf4j;
public class QnjrcmzListener implements ApplicationListener<ApplicationStartingEvent> {
@Override
public void onApplicationEvent(ApplicationStartingEvent event) {
public void onApplicationEvent(@NonNull ApplicationStartingEvent event) {
synchronized (QnjrcmzListener.class) {
log.debug("配置忽略证书域名校验");
// 配置JDK HTTPClient域名校验问题

View File

@@ -2,6 +2,7 @@ package com.acgist.taoyao.listener;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;
import com.acgist.taoyao.boot.annotation.Listener;
import com.acgist.taoyao.boot.config.TaoyaoProperties;
@@ -19,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
public class ThyjxcfListener implements ApplicationListener<ApplicationReadyEvent> {
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
public void onApplicationEvent(@NonNull ApplicationReadyEvent event) {
synchronized (ThyjxcfListener.class) {
final TaoyaoProperties taoyaoProperties = event.getApplicationContext().getBean(TaoyaoProperties.class);
log.info("项目启动成功:{}", taoyaoProperties.getName());

View File

@@ -6,6 +6,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.springframework.lang.NonNull;
import org.springframework.test.context.TestContext;
import org.springframework.test.context.TestExecutionListener;
@@ -20,13 +21,13 @@ import lombok.extern.slf4j.Slf4j;
public class CostedTestTestExecutionListener implements TestExecutionListener {
@Override
public void afterTestMethod(TestContext testContext) throws Exception {
public void afterTestMethod(@NonNull TestContext testContext) throws Exception {
final CostedTest costedTest = testContext.getTestMethod().getDeclaredAnnotation(CostedTest.class);
if(costedTest == null) {
return;
}
final int count = costedTest.count();
final int thread = costedTest.thread();
final int count = costedTest.count();
final int thread = costedTest.thread();
final long timeout = costedTest.timeout();
final TimeUnit timeUnit = costedTest.timeUnit();
final long aTime = System.currentTimeMillis();