mirror of
				https://github.com/continew-org/continew-starter.git
				synced 2025-10-31 10:57:15 +08:00 
			
		
		
		
	refactor: 优化项目自动配置,自动导入 Hutool SpringUtil
This commit is contained in:
		| @@ -19,6 +19,8 @@ package top.charles7c.continew.starter.core.autoconfigure.project; | |||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.boot.autoconfigure.AutoConfiguration; | import org.springframework.boot.autoconfigure.AutoConfiguration; | ||||||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||||||
|  | import org.springframework.context.annotation.ComponentScan; | ||||||
|  | import org.springframework.context.annotation.Import; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 项目自动配置 |  * 项目自动配置 | ||||||
| @@ -28,6 +30,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties | |||||||
|  */ |  */ | ||||||
| @Slf4j | @Slf4j | ||||||
| @AutoConfiguration | @AutoConfiguration | ||||||
|  | @ComponentScan("cn.hutool.extra.spring") | ||||||
|  | @Import(cn.hutool.extra.spring.SpringUtil.class) | ||||||
| @EnableConfigurationProperties(ProjectProperties.class) | @EnableConfigurationProperties(ProjectProperties.class) | ||||||
| public class ProjectAutoConfiguration { | public class ProjectAutoConfiguration { | ||||||
| } | } | ||||||
|   | |||||||
| @@ -32,10 +32,6 @@ import top.charles7c.continew.starter.core.autoconfigure.project.ProjectProperti | |||||||
| /** | /** | ||||||
|  * IP 工具类 |  * IP 工具类 | ||||||
|  * |  * | ||||||
|  * <p> |  | ||||||
|  *     使用本地解析时请提前引入 Hutool SpringUtil,详情请见<a href="https://doc.hutool.cn/pages/SpringUtil">引入方式</a>。 |  | ||||||
|  * </p> |  | ||||||
|  * |  | ||||||
|  * @author Charles7c |  * @author Charles7c | ||||||
|  * @since 1.0.0 |  * @since 1.0.0 | ||||||
|  */ |  */ | ||||||
| @@ -51,8 +47,7 @@ public class IpUtils { | |||||||
|     /** |     /** | ||||||
|      * 根据 IP 获取归属地信息 |      * 根据 IP 获取归属地信息 | ||||||
|      * |      * | ||||||
|      * @param ip |      * @param ip IP 地址 | ||||||
|      *            IP 地址 |  | ||||||
|      * @return 归属地信息 |      * @return 归属地信息 | ||||||
|      */ |      */ | ||||||
|     public static String getCityInfo(String ip) { |     public static String getCityInfo(String ip) { | ||||||
| @@ -66,8 +61,7 @@ public class IpUtils { | |||||||
|     /** |     /** | ||||||
|      * 根据 IP 获取归属地信息(网络解析) |      * 根据 IP 获取归属地信息(网络解析) | ||||||
|      * |      * | ||||||
|      * @param ip |      * @param ip IP 地址 | ||||||
|      *            IP 地址 |  | ||||||
|      * @return 归属地信息 |      * @return 归属地信息 | ||||||
|      */ |      */ | ||||||
|     public static String getHttpCityInfo(String ip) { |     public static String getHttpCityInfo(String ip) { | ||||||
| @@ -82,8 +76,7 @@ public class IpUtils { | |||||||
|     /** |     /** | ||||||
|      * 根据 IP 获取归属地信息(本地解析) |      * 根据 IP 获取归属地信息(本地解析) | ||||||
|      * |      * | ||||||
|      * @param ip |      * @param ip IP 地址 | ||||||
|      *            IP 地址 |  | ||||||
|      * @return 归属地信息 |      * @return 归属地信息 | ||||||
|      */ |      */ | ||||||
|     public static String getLocalCityInfo(String ip) { |     public static String getLocalCityInfo(String ip) { | ||||||
| @@ -101,8 +94,7 @@ public class IpUtils { | |||||||
|     /** |     /** | ||||||
|      * 是否为内网 IPv4 |      * 是否为内网 IPv4 | ||||||
|      * |      * | ||||||
|      * @param ip |      * @param ip IP 地址 | ||||||
|      *            IP 地址 |  | ||||||
|      * @return 是否为内网 IP |      * @return 是否为内网 IP | ||||||
|      */ |      */ | ||||||
|     public static boolean isInnerIp(String ip) { |     public static boolean isInnerIp(String ip) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user