diff --git a/application/src/main/java/run/halo/app/core/user/service/RoleService.java b/api/src/main/java/run/halo/app/core/user/service/RoleService.java similarity index 100% rename from application/src/main/java/run/halo/app/core/user/service/RoleService.java rename to api/src/main/java/run/halo/app/core/user/service/RoleService.java diff --git a/application/src/main/java/run/halo/app/core/user/service/SignUpData.java b/api/src/main/java/run/halo/app/core/user/service/SignUpData.java similarity index 100% rename from application/src/main/java/run/halo/app/core/user/service/SignUpData.java rename to api/src/main/java/run/halo/app/core/user/service/SignUpData.java diff --git a/application/src/main/java/run/halo/app/core/user/service/UserService.java b/api/src/main/java/run/halo/app/core/user/service/UserService.java similarity index 100% rename from application/src/main/java/run/halo/app/core/user/service/UserService.java rename to api/src/main/java/run/halo/app/core/user/service/UserService.java diff --git a/application/src/main/java/run/halo/app/infra/ValidationUtils.java b/api/src/main/java/run/halo/app/infra/ValidationUtils.java similarity index 96% rename from application/src/main/java/run/halo/app/infra/ValidationUtils.java rename to api/src/main/java/run/halo/app/infra/ValidationUtils.java index 9252e2298f..e0b5b16c5d 100644 --- a/application/src/main/java/run/halo/app/infra/ValidationUtils.java +++ b/api/src/main/java/run/halo/app/infra/ValidationUtils.java @@ -15,7 +15,7 @@ public class ValidationUtils { public static final Pattern NAME_PATTERN = Pattern.compile(NAME_REGEX); /** - * A-Z, a-z, 0-9, !@#$%^&* are allowed. + * {@code A-Z, a-z, 0-9, !@#$%^&*} are allowed. */ public static final String PASSWORD_REGEX = "^[A-Za-z0-9!@#$%^&*]+$"; diff --git a/application/src/main/java/run/halo/app/plugin/SharedApplicationContextFactory.java b/application/src/main/java/run/halo/app/plugin/SharedApplicationContextFactory.java index fb264197d5..16da32adbe 100644 --- a/application/src/main/java/run/halo/app/plugin/SharedApplicationContextFactory.java +++ b/application/src/main/java/run/halo/app/plugin/SharedApplicationContextFactory.java @@ -8,6 +8,8 @@ import org.springframework.security.web.server.savedrequest.ServerRequestCache; import run.halo.app.content.PostContentService; import run.halo.app.core.extension.service.AttachmentService; +import run.halo.app.core.user.service.RoleService; +import run.halo.app.core.user.service.UserService; import run.halo.app.extension.DefaultSchemeManager; import run.halo.app.extension.ExtensionClient; import run.halo.app.extension.ReactiveExtensionClient; @@ -86,6 +88,10 @@ public static ApplicationContext create(ApplicationContext rootContext) { .ifUnique(serverRequestCache -> beanFactory.registerSingleton("serverRequestCache", serverRequestCache) ); + rootContext.getBeanProvider(UserService.class) + .ifUnique(userService -> beanFactory.registerSingleton("userService", userService)); + rootContext.getBeanProvider(RoleService.class) + .ifUnique(roleService -> beanFactory.registerSingleton("roleService", roleService)); // TODO add more shared instance here sharedContext.refresh();