diff --git a/base-framework-cache-starter/src/main/java/com/fuhouyu/framework/cache/properties/CacheServiceProperties.java b/base-framework-cache-starter/src/main/java/com/fuhouyu/framework/cache/properties/CacheServiceProperties.java index 1294efc..f3eefb7 100644 --- a/base-framework-cache-starter/src/main/java/com/fuhouyu/framework/cache/properties/CacheServiceProperties.java +++ b/base-framework-cache-starter/src/main/java/com/fuhouyu/framework/cache/properties/CacheServiceProperties.java @@ -17,7 +17,7 @@ package com.fuhouyu.framework.cache.properties; import com.fuhouyu.framework.cache.enums.CacheServiceTypeEnum; -import com.fuhouyu.framework.constants.ConfigPropertiesConstant; +import com.fuhouyu.framework.common.constants.ConfigPropertiesConstant; import lombok.Getter; import lombok.Setter; import lombok.ToString; diff --git a/base-framework-cache-starter/src/main/java/module-info.java b/base-framework-cache-starter/src/main/java/module-info.java new file mode 100644 index 0000000..07f0cc1 --- /dev/null +++ b/base-framework-cache-starter/src/main/java/module-info.java @@ -0,0 +1,39 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module base.framework.cache.starter { + // 透传 + requires transitive base.framework.common; + requires transitive com.github.benmanes.caffeine; + requires transitive com.fasterxml.jackson.annotation; + requires transitive com.fasterxml.jackson.databind; + requires org.checkerframework.checker.qual; + requires spring.boot; + requires spring.boot.autoconfigure; + requires spring.context; + requires spring.tx; + requires spring.data.redis; + + // 需要导出的类 + exports com.fuhouyu.framework.cache; + exports com.fuhouyu.framework.cache.enums; + exports com.fuhouyu.framework.cache.properties; + exports com.fuhouyu.framework.cache.service; + exports com.fuhouyu.framework.cache.service.impl; + + uses com.fuhouyu.framework.cache.service.CacheService; + opens com.fuhouyu.framework.cache to spring.core; + +} \ No newline at end of file diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/Entity.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/Entity.java similarity index 96% rename from base-framework-common/src/main/java/com/fuhouyu/framework/Entity.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/Entity.java index 280bf27..a3ebc2a 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/Entity.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/Entity.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework; +package com.fuhouyu.framework.common; import java.io.Serializable; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/ValueObject.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/ValueObject.java similarity index 96% rename from base-framework-common/src/main/java/com/fuhouyu/framework/ValueObject.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/ValueObject.java index 1b1ca80..1bdabbb 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/ValueObject.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/ValueObject.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework; +package com.fuhouyu.framework.common; import java.io.Serializable; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/ValueObjectSupport.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/ValueObjectSupport.java similarity index 97% rename from base-framework-common/src/main/java/com/fuhouyu/framework/ValueObjectSupport.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/ValueObjectSupport.java index 2d070b2..4dc354f 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/ValueObjectSupport.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/ValueObjectSupport.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework; +package com.fuhouyu.framework.common; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/constants/ConfigPropertiesConstant.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/constants/ConfigPropertiesConstant.java similarity index 95% rename from base-framework-common/src/main/java/com/fuhouyu/framework/constants/ConfigPropertiesConstant.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/constants/ConfigPropertiesConstant.java index a4cf895..7834a6c 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/constants/ConfigPropertiesConstant.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/constants/ConfigPropertiesConstant.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.constants; +package com.fuhouyu.framework.common.constants; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/constants/HttpRequestHeaderConstant.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/constants/HttpRequestHeaderConstant.java similarity index 97% rename from base-framework-common/src/main/java/com/fuhouyu/framework/constants/HttpRequestHeaderConstant.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/constants/HttpRequestHeaderConstant.java index 8fd08ab..b138090 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/constants/HttpRequestHeaderConstant.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/constants/HttpRequestHeaderConstant.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.constants; +package com.fuhouyu.framework.common.constants; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/exception/FileException.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/exception/FileException.java similarity index 95% rename from base-framework-common/src/main/java/com/fuhouyu/framework/exception/FileException.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/exception/FileException.java index cb06fa2..afcdb73 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/exception/FileException.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/exception/FileException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework.exception; +package com.fuhouyu.framework.common.exception; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/exception/JsonParseException.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/exception/JsonParseException.java similarity index 95% rename from base-framework-common/src/main/java/com/fuhouyu/framework/exception/JsonParseException.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/exception/JsonParseException.java index 12ee773..b0072a1 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/exception/JsonParseException.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/exception/JsonParseException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.exception; +package com.fuhouyu.framework.common.exception; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/function/Callback.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/function/Callback.java similarity index 94% rename from base-framework-common/src/main/java/com/fuhouyu/framework/function/Callback.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/function/Callback.java index be19863..4bdd713 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/function/Callback.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/function/Callback.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework.function; +package com.fuhouyu.framework.common.function; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/common/package-info.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/package-info.java new file mode 100644 index 0000000..2c6d69e --- /dev/null +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * 公共组件,主要定义所有依赖的公共项 + */ +package com.fuhouyu.framework.common; \ No newline at end of file diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/response/BaseResponse.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/response/BaseResponse.java similarity index 96% rename from base-framework-common/src/main/java/com/fuhouyu/framework/response/BaseResponse.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/response/BaseResponse.java index b4c3c20..a6901f9 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/response/BaseResponse.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/response/BaseResponse.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework.response; +package com.fuhouyu.framework.common.response; import java.io.Serializable; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/response/BaseResponseCode.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/response/BaseResponseCode.java similarity index 95% rename from base-framework-common/src/main/java/com/fuhouyu/framework/response/BaseResponseCode.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/response/BaseResponseCode.java index c83a790..394dc00 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/response/BaseResponseCode.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/response/BaseResponseCode.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.response; +package com.fuhouyu.framework.common.response; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/service/AdditionalInformationFunction.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/service/AdditionalInformationFunction.java similarity index 96% rename from base-framework-common/src/main/java/com/fuhouyu/framework/service/AdditionalInformationFunction.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/service/AdditionalInformationFunction.java index 3e2b878..b28aaee 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/service/AdditionalInformationFunction.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/service/AdditionalInformationFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework.service; +package com.fuhouyu.framework.common.service; import java.util.Map; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/service/Callback.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/service/Callback.java similarity index 94% rename from base-framework-common/src/main/java/com/fuhouyu/framework/service/Callback.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/service/Callback.java index 93fad15..0dd2fe0 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/service/Callback.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/service/Callback.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.service; +package com.fuhouyu.framework.common.service; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/ClassUtil.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/ClassUtil.java similarity index 96% rename from base-framework-common/src/main/java/com/fuhouyu/framework/utils/ClassUtil.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/ClassUtil.java index f8d5831..4f665ca 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/ClassUtil.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/ClassUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.utils; +package com.fuhouyu.framework.common.utils; /** *

diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/FileUtil.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/FileUtil.java similarity index 98% rename from base-framework-common/src/main/java/com/fuhouyu/framework/utils/FileUtil.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/FileUtil.java index ebba8ee..12bae6e 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/FileUtil.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/FileUtil.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package com.fuhouyu.framework.utils; +package com.fuhouyu.framework.common.utils; -import com.fuhouyu.framework.exception.FileException; +import com.fuhouyu.framework.common.exception.FileException; import lombok.NonNull; import java.io.IOException; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/HexUtil.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/HexUtil.java similarity index 98% rename from base-framework-common/src/main/java/com/fuhouyu/framework/utils/HexUtil.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/HexUtil.java index cd4919b..2a476e5 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/HexUtil.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/HexUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.utils; +package com.fuhouyu.framework.common.utils; import java.nio.charset.StandardCharsets; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/HttpRequestUtil.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/HttpRequestUtil.java similarity index 94% rename from base-framework-common/src/main/java/com/fuhouyu/framework/utils/HttpRequestUtil.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/HttpRequestUtil.java index a87844d..ca9b589 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/HttpRequestUtil.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/HttpRequestUtil.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package com.fuhouyu.framework.utils; +package com.fuhouyu.framework.common.utils; -import com.fuhouyu.framework.constants.HttpRequestHeaderConstant; +import com.fuhouyu.framework.common.constants.HttpRequestHeaderConstant; import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/JacksonUtil.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/JacksonUtil.java similarity index 98% rename from base-framework-common/src/main/java/com/fuhouyu/framework/utils/JacksonUtil.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/JacksonUtil.java index 6017e87..4356787 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/JacksonUtil.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/JacksonUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.utils; +package com.fuhouyu.framework.common.utils; import com.fasterxml.jackson.core.JacksonException; import com.fasterxml.jackson.core.type.TypeReference; @@ -26,7 +26,7 @@ import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; -import com.fuhouyu.framework.exception.JsonParseException; +import com.fuhouyu.framework.common.exception.JsonParseException; import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/LoggerUtil.java b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/LoggerUtil.java similarity index 98% rename from base-framework-common/src/main/java/com/fuhouyu/framework/utils/LoggerUtil.java rename to base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/LoggerUtil.java index 54289b7..8618f45 100644 --- a/base-framework-common/src/main/java/com/fuhouyu/framework/utils/LoggerUtil.java +++ b/base-framework-common/src/main/java/com/fuhouyu/framework/common/utils/LoggerUtil.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.fuhouyu.framework.utils; +package com.fuhouyu.framework.common.utils; import org.slf4j.Logger; diff --git a/base-framework-common/src/main/java/module-info.java b/base-framework-common/src/main/java/module-info.java new file mode 100644 index 0000000..5fb73f0 --- /dev/null +++ b/base-framework-common/src/main/java/module-info.java @@ -0,0 +1,33 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module base.framework.common { + // 以下依赖都需要传递给其依赖项 + requires transitive lombok; + requires transitive com.fasterxml.jackson.datatype.jsr310; + requires transitive jakarta.servlet; + requires transitive org.apache.commons.lang3; + requires transitive org.slf4j; + requires transitive com.fasterxml.jackson.databind; + + exports com.fuhouyu.framework.common; + exports com.fuhouyu.framework.common.constants; + exports com.fuhouyu.framework.common.exception; + exports com.fuhouyu.framework.common.function; + exports com.fuhouyu.framework.common.response; + exports com.fuhouyu.framework.common.service; + exports com.fuhouyu.framework.common.utils; +} \ No newline at end of file diff --git a/base-framework-context/src/main/java/com/fuhouyu/framework/context/Request.java b/base-framework-context/src/main/java/com/fuhouyu/framework/context/Request.java index 80642ef..99ecbbe 100644 --- a/base-framework-context/src/main/java/com/fuhouyu/framework/context/Request.java +++ b/base-framework-context/src/main/java/com/fuhouyu/framework/context/Request.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.context; -import com.fuhouyu.framework.service.AdditionalInformationFunction; +import com.fuhouyu.framework.common.service.AdditionalInformationFunction; import java.io.Serializable; diff --git a/base-framework-context/src/main/java/com/fuhouyu/framework/context/User.java b/base-framework-context/src/main/java/com/fuhouyu/framework/context/User.java index 6a26c4b..7a9ec6c 100644 --- a/base-framework-context/src/main/java/com/fuhouyu/framework/context/User.java +++ b/base-framework-context/src/main/java/com/fuhouyu/framework/context/User.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.context; -import com.fuhouyu.framework.service.AdditionalInformationFunction; +import com.fuhouyu.framework.common.service.AdditionalInformationFunction; import java.io.Serializable; diff --git a/base-framework-context/src/main/java/com/fuhouyu/framework/context/package-info.java b/base-framework-context/src/main/java/com/fuhouyu/framework/context/package-info.java new file mode 100644 index 0000000..10646b2 --- /dev/null +++ b/base-framework-context/src/main/java/com/fuhouyu/framework/context/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * 上下文组件包 + */ +package com.fuhouyu.framework.context; \ No newline at end of file diff --git a/base-framework-context/src/main/java/module-info.java b/base-framework-context/src/main/java/module-info.java new file mode 100644 index 0000000..7d90ea7 --- /dev/null +++ b/base-framework-context/src/main/java/module-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module base.framework.context { + requires transitive base.framework.common; + + exports com.fuhouyu.framework.context; + exports com.fuhouyu.framework.context.exception; +} \ No newline at end of file diff --git a/base-framework-database/src/main/java/com/fuhouyu/framework/database/package-info.java b/base-framework-database/src/main/java/com/fuhouyu/framework/database/package-info.java new file mode 100644 index 0000000..e767e05 --- /dev/null +++ b/base-framework-database/src/main/java/com/fuhouyu/framework/database/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * 数据库相关组件 + */ +package com.fuhouyu.framework.database; \ No newline at end of file diff --git a/base-framework-database/src/main/java/module-info.java b/base-framework-database/src/main/java/module-info.java new file mode 100644 index 0000000..deb069c --- /dev/null +++ b/base-framework-database/src/main/java/module-info.java @@ -0,0 +1,22 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module base.framework.database { + requires org.mybatis; + + exports com.fuhouyu.framework.database.interceptor; + exports com.fuhouyu.framework.database.annotations; +} \ No newline at end of file diff --git a/base-framework-kms-starter/src/main/java/com/fuhouyu/framework/kms/package-info.java b/base-framework-kms-starter/src/main/java/com/fuhouyu/framework/kms/package-info.java new file mode 100644 index 0000000..f4e7c83 --- /dev/null +++ b/base-framework-kms-starter/src/main/java/com/fuhouyu/framework/kms/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * kms组件 + */ +package com.fuhouyu.framework.kms; \ No newline at end of file diff --git a/base-framework-kms-starter/src/main/java/com/fuhouyu/framework/kms/properties/KmsDefaultProperties.java b/base-framework-kms-starter/src/main/java/com/fuhouyu/framework/kms/properties/KmsDefaultProperties.java index 04ebdc0..ea72e8f 100644 --- a/base-framework-kms-starter/src/main/java/com/fuhouyu/framework/kms/properties/KmsDefaultProperties.java +++ b/base-framework-kms-starter/src/main/java/com/fuhouyu/framework/kms/properties/KmsDefaultProperties.java @@ -18,7 +18,7 @@ import cn.hutool.crypto.Mode; import cn.hutool.crypto.Padding; -import com.fuhouyu.framework.constants.ConfigPropertiesConstant; +import com.fuhouyu.framework.common.constants.ConfigPropertiesConstant; import lombok.Getter; import lombok.Setter; import lombok.ToString; diff --git a/base-framework-kms-starter/src/main/java/module-info.java b/base-framework-kms-starter/src/main/java/module-info.java new file mode 100644 index 0000000..e89293c --- /dev/null +++ b/base-framework-kms-starter/src/main/java/module-info.java @@ -0,0 +1,34 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module base.framework.kms.starter { + requires transitive base.framework.common; + requires transitive org.bouncycastle.provider; + + requires cn.hutool.crypto; + requires spring.boot; + requires spring.boot.autoconfigure; + requires spring.context; + requires spring.core; + + exports com.fuhouyu.framework.kms; + exports com.fuhouyu.framework.kms.exception; + exports com.fuhouyu.framework.kms.properties; + exports com.fuhouyu.framework.kms.service; + + uses com.fuhouyu.framework.kms.service.KmsService; + // spring 需要反射访问当前包 + opens com.fuhouyu.framework.kms to spring.core; +} \ No newline at end of file diff --git a/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/core/LogRecordAspectj.java b/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/core/LogRecordAspectj.java index 6be25a8..cb1edf6 100644 --- a/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/core/LogRecordAspectj.java +++ b/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/core/LogRecordAspectj.java @@ -16,11 +16,11 @@ package com.fuhouyu.framework.log.core; +import com.fuhouyu.framework.common.utils.JacksonUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.context.ContextHolderStrategy; import com.fuhouyu.framework.log.exception.LogException; import com.fuhouyu.framework.log.model.LogRecord; -import com.fuhouyu.framework.utils.JacksonUtil; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.Signature; diff --git a/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/package-info.java b/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/package-info.java new file mode 100644 index 0000000..8e3ff58 --- /dev/null +++ b/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * 日志组件 + */ +package com.fuhouyu.framework.log; \ No newline at end of file diff --git a/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/properties/LogRecordProperties.java b/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/properties/LogRecordProperties.java index ce2c528..97c5aa8 100644 --- a/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/properties/LogRecordProperties.java +++ b/base-framework-log-starter/src/main/java/com/fuhouyu/framework/log/properties/LogRecordProperties.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.log.properties; -import com.fuhouyu.framework.constants.ConfigPropertiesConstant; +import com.fuhouyu.framework.common.constants.ConfigPropertiesConstant; import lombok.Getter; import lombok.Setter; import lombok.ToString; diff --git a/base-framework-log-starter/src/main/java/module-info.java b/base-framework-log-starter/src/main/java/module-info.java new file mode 100644 index 0000000..2cd6039 --- /dev/null +++ b/base-framework-log-starter/src/main/java/module-info.java @@ -0,0 +1,37 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module base.framework.log.starter { + requires transitive base.framework.context; + + requires org.aspectj.weaver; + requires spring.beans; + requires spring.boot; + requires spring.boot.autoconfigure; + requires spring.context; + requires spring.core; + requires spring.expression; + + exports com.fuhouyu.framework.log; + exports com.fuhouyu.framework.log.annotaions; + + exports com.fuhouyu.framework.log.enums; + exports com.fuhouyu.framework.log.exception; + exports com.fuhouyu.framework.log.model; + exports com.fuhouyu.framework.log.properties; + exports com.fuhouyu.framework.log.core; + + opens com.fuhouyu.framework.log to spring.core; +} \ No newline at end of file diff --git a/base-framework-log-starter/src/test/java/com/fuhouyu/framework/log/LogRecordStoreTest.java b/base-framework-log-starter/src/test/java/com/fuhouyu/framework/log/LogRecordStoreTest.java index 18950cf..fc9acb4 100644 --- a/base-framework-log-starter/src/test/java/com/fuhouyu/framework/log/LogRecordStoreTest.java +++ b/base-framework-log-starter/src/test/java/com/fuhouyu/framework/log/LogRecordStoreTest.java @@ -16,13 +16,13 @@ package com.fuhouyu.framework.log; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.context.ContextHolderStrategy; import com.fuhouyu.framework.context.DefaultListableContextFactory; import com.fuhouyu.framework.context.User; import com.fuhouyu.framework.log.annotaions.LogRecord; import com.fuhouyu.framework.log.core.LogRecordStoreService; import com.fuhouyu.framework.log.enums.OperationTypeEnum; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/AliYunOssAutoConfiguration.java b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/AliYunOssAutoConfiguration.java index ff20e29..8617299 100644 --- a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/AliYunOssAutoConfiguration.java +++ b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/AliYunOssAutoConfiguration.java @@ -21,12 +21,12 @@ import com.aliyun.oss.common.auth.CredentialsProviderFactory; import com.aliyun.oss.common.auth.STSAssumeRoleSessionCredentialsProvider; import com.aliyuncs.exceptions.ClientException; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.resource.properties.AliYunOssProperties; import com.fuhouyu.framework.resource.properties.BaseOssResourceProperties; import com.fuhouyu.framework.resource.properties.ResourceProperties; import com.fuhouyu.framework.resource.service.ResourceService; import com.fuhouyu.framework.resource.service.impl.AliYunOssServiceImpl; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.InitializingBean; diff --git a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/package-info.java b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/package-info.java new file mode 100644 index 0000000..8bb55ad --- /dev/null +++ b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * 资源组件 + */ +package com.fuhouyu.framework.resource; \ No newline at end of file diff --git a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/properties/ResourceProperties.java b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/properties/ResourceProperties.java index da53900..fab74a0 100644 --- a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/properties/ResourceProperties.java +++ b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/properties/ResourceProperties.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.resource.properties; -import com.fuhouyu.framework.constants.ConfigPropertiesConstant; +import com.fuhouyu.framework.common.constants.ConfigPropertiesConstant; import com.fuhouyu.framework.resource.enums.ResourceUploadTypeEnum; import lombok.Getter; import lombok.Setter; diff --git a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/AliYunOssServiceImpl.java b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/AliYunOssServiceImpl.java index d67d5f6..518919d 100644 --- a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/AliYunOssServiceImpl.java +++ b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/AliYunOssServiceImpl.java @@ -20,11 +20,11 @@ import com.aliyun.oss.OSSException; import com.aliyun.oss.model.*; import com.fasterxml.jackson.core.type.TypeReference; +import com.fuhouyu.framework.common.utils.JacksonUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.resource.exception.ResourceException; import com.fuhouyu.framework.resource.model.*; import com.fuhouyu.framework.resource.service.ResourceService; -import com.fuhouyu.framework.utils.JacksonUtil; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/LocalFileServiceImpl.java b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/LocalFileServiceImpl.java index 709dd9d..da8e129 100644 --- a/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/LocalFileServiceImpl.java +++ b/base-framework-resource-starter/src/main/java/com/fuhouyu/framework/resource/service/impl/LocalFileServiceImpl.java @@ -16,13 +16,13 @@ package com.fuhouyu.framework.resource.service.impl; +import com.fuhouyu.framework.common.service.Callback; +import com.fuhouyu.framework.common.utils.FileUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.resource.constants.FileResourceMetadataConstant; import com.fuhouyu.framework.resource.exception.ResourceException; import com.fuhouyu.framework.resource.model.*; import com.fuhouyu.framework.resource.service.ResourceService; -import com.fuhouyu.framework.service.Callback; -import com.fuhouyu.framework.utils.FileUtil; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.extern.slf4j.Slf4j; import java.io.*; diff --git a/base-framework-resource-starter/src/main/java/module-info.java b/base-framework-resource-starter/src/main/java/module-info.java new file mode 100644 index 0000000..5f7dfd4 --- /dev/null +++ b/base-framework-resource-starter/src/main/java/module-info.java @@ -0,0 +1,36 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module base.framework.resource.starter { + requires aliyun.java.sdk.core; + requires aliyun.sdk.oss; + requires transitive base.framework.common; + requires transitive com.fasterxml.jackson.core; + requires spring.beans; + requires spring.boot; + requires spring.boot.autoconfigure; + requires spring.context; + requires spring.core; + + opens com.fuhouyu.framework.resource to spring.core; + + exports com.fuhouyu.framework.resource; + exports com.fuhouyu.framework.resource.constants; + exports com.fuhouyu.framework.resource.enums; + exports com.fuhouyu.framework.resource.exception; + exports com.fuhouyu.framework.resource.model; + exports com.fuhouyu.framework.resource.properties; + exports com.fuhouyu.framework.resource.service; +} \ No newline at end of file diff --git a/base-framework-resource-starter/src/test/java/com/fuhouyu/framework/resource/ResourceServiceTest.java b/base-framework-resource-starter/src/test/java/com/fuhouyu/framework/resource/ResourceServiceTest.java index d5aa2d8..6935b79 100644 --- a/base-framework-resource-starter/src/test/java/com/fuhouyu/framework/resource/ResourceServiceTest.java +++ b/base-framework-resource-starter/src/test/java/com/fuhouyu/framework/resource/ResourceServiceTest.java @@ -17,10 +17,10 @@ package com.fuhouyu.framework.resource; +import com.fuhouyu.framework.common.utils.FileUtil; import com.fuhouyu.framework.resource.exception.ResourceException; import com.fuhouyu.framework.resource.model.*; import com.fuhouyu.framework.resource.service.ResourceService; -import com.fuhouyu.framework.utils.FileUtil; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; diff --git a/base-framework-security-starter/pom.xml b/base-framework-security-starter/pom.xml index 07c0ba6..8c6b674 100644 --- a/base-framework-security-starter/pom.xml +++ b/base-framework-security-starter/pom.xml @@ -88,5 +88,10 @@ com.fuhouyu base-framework-context + + org.springframework.boot + spring-boot-starter-data-redis + true + \ No newline at end of file diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/AbstractAuthenticationProvider.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/AbstractAuthenticationProvider.java index df29e38..df6e90a 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/AbstractAuthenticationProvider.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/AbstractAuthenticationProvider.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.security.core; -import com.fuhouyu.framework.utils.LoggerUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationServiceException; diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenEnum.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenEnum.java index 80787b9..5ed163a 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenEnum.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenEnum.java @@ -15,6 +15,7 @@ */ package com.fuhouyu.framework.security.core; +import com.fuhouyu.framework.security.core.authentication.refreshtoken.RefreshAuthenticationProvider; import com.fuhouyu.framework.security.core.authentication.wechat.WechatAppletsPlatformProvider; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -33,12 +34,25 @@ @SuppressWarnings("unchecked") public enum GrantTypeAuthenticationTokenEnum implements GrantTypeAuthenticationTokenMapping { + /** + * 微信小程序 + */ WECHAT_APPLETS("WECHAT_APPLETS") { @Override public Class getAuthenticationTokenClass() { return (Class) WechatAppletsPlatformProvider.WechatAppletsAuthenticationToken.class; } }, + + /** + * 刷新令牌 + */ + REFRESH_TOKEN("REFRESH_TOKEN") { + @Override + public Class getAuthenticationTokenClass() { + return (Class) RefreshAuthenticationProvider.RefreshAuthenticationToken.class; + } + } ; private final String grantType; diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenMapping.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenMapping.java index 8b661fd..48dd373 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenMapping.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/GrantTypeAuthenticationTokenMapping.java @@ -15,7 +15,7 @@ */ package com.fuhouyu.framework.security.core; -import com.fuhouyu.framework.utils.JacksonUtil; +import com.fuhouyu.framework.common.utils.JacksonUtil; import org.springframework.security.authentication.AbstractAuthenticationToken; /** diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/authentication/refreshtoken/RefreshAuthenticationProvider.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/authentication/refreshtoken/RefreshAuthenticationProvider.java new file mode 100644 index 0000000..4ef8292 --- /dev/null +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/authentication/refreshtoken/RefreshAuthenticationProvider.java @@ -0,0 +1,94 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.fuhouyu.framework.security.core.authentication.refreshtoken; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fuhouyu.framework.security.token.TokenStore; +import lombok.EqualsAndHashCode; +import lombok.RequiredArgsConstructor; +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.util.StringUtils; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 刷新令牌provider + *

+ * + * @author fuhouyu + * @since 2024/10/22 22:17 + */ +@RequiredArgsConstructor +public class RefreshAuthenticationProvider implements AuthenticationProvider { + + private final TokenStore tokenStore; + + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + String refreshToken = (String) authentication.getPrincipal(); + if (!StringUtils.hasText(refreshToken)) { + throw new IllegalArgumentException("刷新令牌为空"); + } + Authentication storeTokenAuthentication = tokenStore.readAuthenticationForRefreshToken( + refreshToken); + if (Objects.isNull(storeTokenAuthentication)) { + throw new IllegalArgumentException("刷牌令牌已过期"); + } + tokenStore.removeAccessTokenUsingRefreshToken(refreshToken); + tokenStore.removeRefreshToken(refreshToken); + return storeTokenAuthentication; + } + + @Override + public boolean supports(Class authentication) { + return RefreshAuthenticationToken.class.isAssignableFrom(authentication); + } + + @EqualsAndHashCode(callSuper = true) + public static class RefreshAuthenticationToken extends AbstractAuthenticationToken { + + private final String refreshToken; + + /** + * 构造函数 + * + * @param refreshToken 刷新令牌 + */ + @JsonCreator + public RefreshAuthenticationToken( + @JsonProperty("refreshToken") String refreshToken) { + super(List.of()); + this.refreshToken = refreshToken; + } + + @Override + public Object getCredentials() { + return null; + } + + @Override + public Object getPrincipal() { + return this.refreshToken; + } + } +} diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/authentication/wechat/WechatAppletsPlatformProvider.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/authentication/wechat/WechatAppletsPlatformProvider.java index 31395ad..ab8cd42 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/authentication/wechat/WechatAppletsPlatformProvider.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/authentication/wechat/WechatAppletsPlatformProvider.java @@ -18,10 +18,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fuhouyu.framework.common.utils.JacksonUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.security.core.AbstractAuthenticationProvider; import com.fuhouyu.framework.security.properties.OpenPlatformAuthProperties; -import com.fuhouyu.framework.utils.JacksonUtil; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.EqualsAndHashCode; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/passwordencoder/Sm3PasswordEncoder.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/passwordencoder/Sm3PasswordEncoder.java index 5fb3d8d..e00276b 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/passwordencoder/Sm3PasswordEncoder.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/core/passwordencoder/Sm3PasswordEncoder.java @@ -17,7 +17,7 @@ package com.fuhouyu.framework.security.core.passwordencoder; import cn.hutool.crypto.SmUtil; -import com.fuhouyu.framework.utils.LoggerUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import lombok.extern.slf4j.Slf4j; import org.apache.hc.client5.http.utils.Base64; import org.springframework.security.crypto.password.PasswordEncoder; diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/entity/TokenEntity.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/entity/TokenEntity.java index c2c5c15..224a857 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/entity/TokenEntity.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/entity/TokenEntity.java @@ -15,7 +15,7 @@ */ package com.fuhouyu.framework.security.entity; -import com.fuhouyu.framework.Entity; +import com.fuhouyu.framework.common.Entity; import lombok.Getter; import lombok.Setter; import lombok.ToString; diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/package-info.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/package-info.java new file mode 100644 index 0000000..515d8bc --- /dev/null +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * security组件 + */ +package com.fuhouyu.framework.security; \ No newline at end of file diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/properties/OpenPlatformAuthProperties.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/properties/OpenPlatformAuthProperties.java index a0984c9..929fb87 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/properties/OpenPlatformAuthProperties.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/properties/OpenPlatformAuthProperties.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.security.properties; -import com.fuhouyu.framework.constants.ConfigPropertiesConstant; +import com.fuhouyu.framework.common.constants.ConfigPropertiesConstant; import com.fuhouyu.framework.security.core.GrantTypeAuthenticationTokenEnum; import lombok.Getter; import lombok.Setter; diff --git a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/token/TokenStoreCache.java b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/token/TokenStoreCache.java index c110bae..56c4118 100644 --- a/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/token/TokenStoreCache.java +++ b/base-framework-security-starter/src/main/java/com/fuhouyu/framework/security/token/TokenStoreCache.java @@ -17,10 +17,10 @@ package com.fuhouyu.framework.security.token; import com.fuhouyu.framework.cache.service.CacheService; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.security.entity.TokenEntity; import com.fuhouyu.framework.security.serializer.KryoSerializer; import com.fuhouyu.framework.security.serializer.SerializationStrategy; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.apache.hc.client5.http.utils.Base64; diff --git a/base-framework-security-starter/src/main/java/module-info.java b/base-framework-security-starter/src/main/java/module-info.java new file mode 100644 index 0000000..0d11b7b --- /dev/null +++ b/base-framework-security-starter/src/main/java/module-info.java @@ -0,0 +1,42 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module base.framework.security.starter { + requires transitive base.framework.cache.starter; + requires transitive base.framework.context; + requires transitive com.fasterxml.jackson.annotation; + requires cn.hutool.crypto; + requires com.esotericsoftware.kryo.kryo5; + requires org.apache.httpcomponents.client5.httpclient5; + requires spring.boot; + requires spring.boot.autoconfigure; + requires spring.context; + requires spring.core; + requires spring.security.core; + requires spring.security.crypto; + requires spring.security.oauth2.core; + requires spring.data.redis; + requires spring.web; + opens com.fuhouyu.framework.security to spring.core; + opens com.fuhouyu.framework.security.entity to com.esotericsoftware.kryo.kryo5; + exports com.fuhouyu.framework.security.core.authentication.refreshtoken to com.fasterxml.jackson.databind; + + exports com.fuhouyu.framework.security; + exports com.fuhouyu.framework.security.core; + exports com.fuhouyu.framework.security.entity; + exports com.fuhouyu.framework.security.properties; + exports com.fuhouyu.framework.security.serializer; + exports com.fuhouyu.framework.security.token; +} \ No newline at end of file diff --git a/base-framework-security-starter/src/test/java/com/fuhouyu/framework/security/RefreshTokenTest.java b/base-framework-security-starter/src/test/java/com/fuhouyu/framework/security/RefreshTokenTest.java new file mode 100644 index 0000000..581a22d --- /dev/null +++ b/base-framework-security-starter/src/test/java/com/fuhouyu/framework/security/RefreshTokenTest.java @@ -0,0 +1,88 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.fuhouyu.framework.security; + +import com.fuhouyu.framework.cache.CacheAutoConfiguration; +import com.fuhouyu.framework.cache.CaffeineCacheAutoconfiguration; +import com.fuhouyu.framework.security.core.GrantTypeAuthenticationTokenEnum; +import com.fuhouyu.framework.security.core.authentication.refreshtoken.RefreshAuthenticationProvider; +import com.fuhouyu.framework.security.entity.TokenEntity; +import com.fuhouyu.framework.security.token.TokenStore; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.TestComponent; +import org.springframework.context.annotation.Bean; +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.test.context.TestPropertySource; + +import java.util.HashMap; +import java.util.Map; + +/** + *

+ * 刷新令牌测试类 + *

+ * + * @author fuhouyu + * @since 2024/10/22 22:21 + */ +@SpringBootTest(classes = { + CacheAutoConfiguration.class, + CaffeineCacheAutoconfiguration.class, + SecurityAutoConfiguration.class, + +}) +@TestPropertySource(locations = {"classpath:application.yaml"}) +class RefreshTokenTest { + + @Autowired + private TokenStore tokenStore; + + @Autowired + private AuthenticationManager authenticationManager; + + @Test + void testRefreshToken() { + UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken("admin", "admin"); + Authentication authenticate = authenticationManager.authenticate(usernamePasswordAuthenticationToken); + TokenEntity tokenEntity = tokenStore.createToken(authenticate, 6000, 6000); + Assertions.assertNotNull(tokenEntity); + + GrantTypeAuthenticationTokenEnum grantTypeAuthenticationTokenEnum = GrantTypeAuthenticationTokenEnum.safeEnumValueOf("REFRESH_TOKEN"); + Map map = new HashMap<>(); + map.put("refreshToken", tokenEntity.getRefreshToken().getTokenValue()); + AbstractAuthenticationToken abstractAuthenticationToken = grantTypeAuthenticationTokenEnum.loadAuthenticationToken(map); + Authentication refreshAuthenticate = authenticationManager.authenticate(abstractAuthenticationToken); + TokenEntity refreshTokenEntity = tokenStore.createToken(refreshAuthenticate, 6000, 6000); + Assertions.assertNotNull(refreshTokenEntity); + } + + @TestComponent + public static class RefreshTokenTestComponent { + + + @Bean + public AuthenticationProvider refreshTokenAuthenticationProvider(TokenStore tokenStore) { + return new RefreshAuthenticationProvider(tokenStore); + } + } +} diff --git a/base-framework-security-starter/src/test/java/com/fuhouyu/framework/security/TokenStoreTest.java b/base-framework-security-starter/src/test/java/com/fuhouyu/framework/security/TokenStoreTest.java index 8b610ac..467a2c2 100644 --- a/base-framework-security-starter/src/test/java/com/fuhouyu/framework/security/TokenStoreTest.java +++ b/base-framework-security-starter/src/test/java/com/fuhouyu/framework/security/TokenStoreTest.java @@ -30,14 +30,18 @@ import org.springframework.context.annotation.Bean; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.oauth2.core.OAuth2RefreshToken; import org.springframework.security.provisioning.InMemoryUserDetailsManager; import org.springframework.test.context.TestPropertySource; import org.springframework.web.client.RestTemplate; +import java.util.Collection; import java.util.Collections; +import java.util.List; /** *

@@ -104,7 +108,23 @@ public RestTemplate restTemplate() { @Bean public UserDetailsService userDetailsService() { - return new InMemoryUserDetailsManager(); + UserDetails userDetails = new UserDetails() { + @Override + public Collection getAuthorities() { + return List.of(); + } + + @Override + public String getPassword() { + return "{noop}admin"; + } + + @Override + public String getUsername() { + return "admin"; + } + }; + return new InMemoryUserDetailsManager(userDetails); } } diff --git a/base-framework-web-starter/pom.xml b/base-framework-web-starter/pom.xml index c4e7144..7d67a3c 100644 --- a/base-framework-web-starter/pom.xml +++ b/base-framework-web-starter/pom.xml @@ -80,6 +80,11 @@ lombok provided + + org.springframework.boot + spring-boot-starter-data-redis + true + \ No newline at end of file diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/WebAutoConfiguration.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/WebAutoConfiguration.java index c5983bc..9e7d80a 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/WebAutoConfiguration.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/WebAutoConfiguration.java @@ -16,9 +16,9 @@ package com.fuhouyu.framework.web; -import com.fuhouyu.framework.constants.HttpRequestHeaderConstant; +import com.fuhouyu.framework.common.constants.HttpRequestHeaderConstant; +import com.fuhouyu.framework.common.utils.JacksonUtil; import com.fuhouyu.framework.kms.service.KmsService; -import com.fuhouyu.framework.utils.JacksonUtil; import com.fuhouyu.framework.web.entity.UserEntity; import com.fuhouyu.framework.web.filter.DefaultHttpBodyFilter; import com.fuhouyu.framework.web.filter.HttpBodyFilter; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/controller/BaseFormController.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/controller/BaseFormController.java index 8477efa..af36fac 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/controller/BaseFormController.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/controller/BaseFormController.java @@ -17,10 +17,10 @@ package com.fuhouyu.framework.web.controller; import com.fuhouyu.framework.cache.service.CacheService; -import com.fuhouyu.framework.response.BaseResponse; +import com.fuhouyu.framework.common.response.BaseResponse; import com.fuhouyu.framework.web.annotaions.PrepareHttpBody; import com.fuhouyu.framework.web.constants.FormTokenConstant; -import com.fuhouyu.framework.web.reponse.ResponseHelper; +import com.fuhouyu.framework.web.response.ResponseHelper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/enums/ResponseCodeEnum.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/enums/ResponseCodeEnum.java index 14f0921..7bec5fd 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/enums/ResponseCodeEnum.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/enums/ResponseCodeEnum.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.web.enums; -import com.fuhouyu.framework.response.BaseResponseCode; +import com.fuhouyu.framework.common.response.BaseResponseCode; /** *

diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebExceptionHandler.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebExceptionHandler.java index a62e9dc..d32b504 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebExceptionHandler.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebExceptionHandler.java @@ -17,11 +17,11 @@ package com.fuhouyu.framework.web.exception; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fuhouyu.framework.response.BaseResponse; -import com.fuhouyu.framework.utils.JacksonUtil; -import com.fuhouyu.framework.utils.LoggerUtil; +import com.fuhouyu.framework.common.response.BaseResponse; +import com.fuhouyu.framework.common.utils.JacksonUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.web.enums.ResponseCodeEnum; -import com.fuhouyu.framework.web.reponse.ResponseHelper; +import com.fuhouyu.framework.web.response.ResponseHelper; import jakarta.validation.ConstraintViolation; import jakarta.validation.ConstraintViolationException; import lombok.extern.slf4j.Slf4j; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebServiceException.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebServiceException.java index 00f8386..1a35ae4 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebServiceException.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/exception/WebServiceException.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.web.exception; -import com.fuhouyu.framework.response.BaseResponseCode; +import com.fuhouyu.framework.common.response.BaseResponseCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/filter/DefaultHttpBodyFilter.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/filter/DefaultHttpBodyFilter.java index 1f1866b..c656c18 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/filter/DefaultHttpBodyFilter.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/filter/DefaultHttpBodyFilter.java @@ -16,10 +16,10 @@ package com.fuhouyu.framework.web.filter; +import com.fuhouyu.framework.common.utils.HexUtil; +import com.fuhouyu.framework.common.utils.JacksonUtil; +import com.fuhouyu.framework.common.utils.LoggerUtil; import com.fuhouyu.framework.kms.service.KmsService; -import com.fuhouyu.framework.utils.HexUtil; -import com.fuhouyu.framework.utils.JacksonUtil; -import com.fuhouyu.framework.utils.LoggerUtil; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/handler/ParseHttpRequest.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/handler/ParseHttpRequest.java index 6596e7a..23ccbeb 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/handler/ParseHttpRequest.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/handler/ParseHttpRequest.java @@ -15,9 +15,9 @@ */ package com.fuhouyu.framework.web.handler; +import com.fuhouyu.framework.common.utils.HttpRequestUtil; import com.fuhouyu.framework.context.Request; import com.fuhouyu.framework.context.User; -import com.fuhouyu.framework.utils.HttpRequestUtil; import com.fuhouyu.framework.web.entity.RequestEntity; import jakarta.servlet.http.HttpServletRequest; import lombok.NonNull; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/properties/WebProperties.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/properties/WebProperties.java index fe51614..df95a3c 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/properties/WebProperties.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/properties/WebProperties.java @@ -16,7 +16,7 @@ package com.fuhouyu.framework.web.properties; -import com.fuhouyu.framework.constants.ConfigPropertiesConstant; +import com.fuhouyu.framework.common.constants.ConfigPropertiesConstant; import lombok.Getter; import lombok.Setter; import lombok.ToString; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/ErrorResponse.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/ErrorResponse.java similarity index 94% rename from base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/ErrorResponse.java rename to base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/ErrorResponse.java index b3f0481..268e7a1 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/ErrorResponse.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/ErrorResponse.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework.web.reponse; +package com.fuhouyu.framework.web.response; -import com.fuhouyu.framework.response.BaseResponse; +import com.fuhouyu.framework.common.response.BaseResponse; import com.fuhouyu.framework.web.enums.ErrorLevelEnum; import com.fuhouyu.framework.web.enums.ResponseCodeEnum; diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/ResponseHelper.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/ResponseHelper.java similarity index 91% rename from base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/ResponseHelper.java rename to base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/ResponseHelper.java index 78cf986..b4f118a 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/ResponseHelper.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/ResponseHelper.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.fuhouyu.framework.web.reponse; +package com.fuhouyu.framework.web.response; -import com.fuhouyu.framework.response.BaseResponse; -import com.fuhouyu.framework.response.BaseResponseCode; +import com.fuhouyu.framework.common.response.BaseResponse; +import com.fuhouyu.framework.common.response.BaseResponseCode; /** *

diff --git a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/SuccessResponse.java b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/SuccessResponse.java similarity index 90% rename from base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/SuccessResponse.java rename to base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/SuccessResponse.java index d369919..a976c33 100644 --- a/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/reponse/SuccessResponse.java +++ b/base-framework-web-starter/src/main/java/com/fuhouyu/framework/web/response/SuccessResponse.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.fuhouyu.framework.web.reponse; +package com.fuhouyu.framework.web.response; -import com.fuhouyu.framework.response.BaseResponse; -import com.fuhouyu.framework.response.BaseResponseCode; +import com.fuhouyu.framework.common.response.BaseResponse; +import com.fuhouyu.framework.common.response.BaseResponseCode; import com.fuhouyu.framework.web.enums.ResponseCodeEnum; import java.io.Serial; diff --git a/base-framework-web-starter/src/main/java/module-info.java b/base-framework-web-starter/src/main/java/module-info.java new file mode 100644 index 0000000..3742000 --- /dev/null +++ b/base-framework-web-starter/src/main/java/module-info.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module base.framework.web.starter { + requires transitive base.framework.cache.starter; + requires transitive base.framework.context; + requires transitive base.framework.kms.starter; + requires transitive jakarta.servlet; + requires transitive jakarta.validation; + requires io.swagger.v3.oas.annotations; + requires org.aspectj.weaver; + requires spring.beans; + requires spring.boot; + requires spring.boot.autoconfigure; + requires spring.context; + requires spring.core; + requires spring.tx; + requires spring.web; + requires spring.webmvc; + + exports com.fuhouyu.framework.web; + exports com.fuhouyu.framework.web.annotaions; + exports com.fuhouyu.framework.web.aspectj; + exports com.fuhouyu.framework.web.constants; + exports com.fuhouyu.framework.web.controller; + exports com.fuhouyu.framework.web.entity; + exports com.fuhouyu.framework.web.enums; + exports com.fuhouyu.framework.web.exception; + exports com.fuhouyu.framework.web.filter; + exports com.fuhouyu.framework.web.handler; + exports com.fuhouyu.framework.web.properties; + exports com.fuhouyu.framework.web.response; + exports com.fuhouyu.framework.web.utils; + + + opens com.fuhouyu.framework.web to spring.core; + opens com.fuhouyu.framework.web.controller to spring.core; + opens com.fuhouyu.framework.web.response to com.fasterxml.jackson.databind; +} \ No newline at end of file diff --git a/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/fileter/HttpControllerTest.java b/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/HttpControllerTest.java similarity index 91% rename from base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/fileter/HttpControllerTest.java rename to base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/HttpControllerTest.java index 668a428..6e21ff7 100644 --- a/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/fileter/HttpControllerTest.java +++ b/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/HttpControllerTest.java @@ -14,18 +14,17 @@ * limitations under the License. */ -package com.fuhouyu.framework.web.fileter; +package com.fuhouyu.framework.web; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fuhouyu.framework.cache.CacheAutoConfiguration; +import com.fuhouyu.framework.common.response.BaseResponse; +import com.fuhouyu.framework.common.utils.HexUtil; +import com.fuhouyu.framework.common.utils.JacksonUtil; import com.fuhouyu.framework.kms.KmsAutoConfiguration; import com.fuhouyu.framework.kms.service.KmsService; -import com.fuhouyu.framework.response.BaseResponse; -import com.fuhouyu.framework.utils.HexUtil; -import com.fuhouyu.framework.utils.JacksonUtil; -import com.fuhouyu.framework.web.WebAutoConfiguration; import com.fuhouyu.framework.web.annotaions.PrepareHttpBody; -import com.fuhouyu.framework.web.reponse.ResponseHelper; +import com.fuhouyu.framework.web.response.ResponseHelper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/form/WebFormNoRepeatSubmitTest.java b/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/WebFormNoRepeatSubmitTest.java similarity index 91% rename from base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/form/WebFormNoRepeatSubmitTest.java rename to base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/WebFormNoRepeatSubmitTest.java index 139e1fa..7eca967 100644 --- a/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/form/WebFormNoRepeatSubmitTest.java +++ b/base-framework-web-starter/src/test/java/com/fuhouyu/framework/web/WebFormNoRepeatSubmitTest.java @@ -14,18 +14,17 @@ * limitations under the License. */ -package com.fuhouyu.framework.web.form; +package com.fuhouyu.framework.web; import com.fasterxml.jackson.core.type.TypeReference; import com.fuhouyu.framework.cache.CacheAutoConfiguration; +import com.fuhouyu.framework.common.response.BaseResponse; +import com.fuhouyu.framework.common.utils.JacksonUtil; import com.fuhouyu.framework.kms.KmsAutoConfiguration; -import com.fuhouyu.framework.response.BaseResponse; -import com.fuhouyu.framework.utils.JacksonUtil; -import com.fuhouyu.framework.web.WebAutoConfiguration; import com.fuhouyu.framework.web.annotaions.NoRepeatSubmit; import com.fuhouyu.framework.web.enums.ErrorLevelEnum; -import com.fuhouyu.framework.web.reponse.ErrorResponse; -import com.fuhouyu.framework.web.reponse.ResponseHelper; +import com.fuhouyu.framework.web.response.ErrorResponse; +import com.fuhouyu.framework.web.response.ResponseHelper; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith;