Refactor: Replace hardcoded path separator with PATH_SEPARATOR constant

Replaced the hardcoded '/' path separator with the `PATH_SEPARATOR` constant
to improve code readability and maintainability. This change ensures
consistency across the codebase when handling path separators.

Closes gh-33646
This commit is contained in:
SungbinYang
2024-10-04 15:06:33 +09:00
committed by Brian Clozel
parent d65bdce0e8
commit 65ac17ee78

View File

@@ -64,6 +64,7 @@ import org.springframework.lang.Nullable;
* @author Rob Harrop
* @author Sam Brannen
* @author Sebastien Deleuze
* @author Sungbin Yang
* @since 1.1
* @see TypeUtils
* @see ReflectionUtils
@@ -694,7 +695,7 @@ public abstract class ClassUtils {
public static String addResourcePathToPackagePath(Class<?> clazz, String resourceName) {
Assert.notNull(resourceName, "Resource name must not be null");
if (!resourceName.startsWith("/")) {
return classPackageAsResourcePath(clazz) + '/' + resourceName;
return classPackageAsResourcePath(clazz) + PATH_SEPARATOR + resourceName;
}
return classPackageAsResourcePath(clazz) + resourceName;
}