Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 Spring 环境下提供一个数据源容器注册器,用于在项目启动后自动批量注册容器 #263

Open
Createsequence opened this issue Apr 18, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Createsequence
Copy link
Collaborator

目前在 Spring 环境中,要注册一个数据源容器的方法只有两种:

  • 直接从 Spring 容器获取 ContainerManager,然后手动注册;
  • 将数据源容器声明为 Spring 的 Bean,然后自动注册;

在新的版本中,希望提供一个介于两者之间的方案,即用户实现 AutoContainerRegistrar 接口创建一个用于注册容器特殊 Bean,它的使用应当类似:

public class ExampleAutoContainerRegistrar implements AutoContainerRegistrar {
    public Collection<Container<?>> getContainers() {
        // 返回要注册的容器列表
    }
}

或:

public class ExampleAutoContainerRegistrar implements AutoContainerRegistrar {
    public void doRegister(ContainerManager manager) {
        // 手动向 manager 进行注册
    }
}

相比起 ContainerProvider,它使用起来更加简单,但是相比起手动注册或将容器声明为 Bean,又具备更好的灵活性。

@Createsequence Createsequence added enhancement New feature or request good first issue Good for newcomers labels Apr 18, 2024
@Createsequence Createsequence added this to the release 2.8.0 milestone Apr 18, 2024
@heliang666s
Copy link

please assign me,thanks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants