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

一些工具类和全局常量等,比如MD5Utils,JSONUtils,DateUtils,这些放在哪一层module呢? #466

Open
Blidenchill opened this issue Nov 9, 2023 · 2 comments

Comments

@Blidenchill
Copy link

一些工具类,比如MD5Utils,JSONUtils,DateUtils,这些放在哪一层呢?正常来说是放在infrastructure层的module,但domain曾不依赖任何module, 导致domain中无法使用这些工具类,但如果把这些工具类放在domain层,感觉又不符合分层原理。有没有大神遇到类似的问题?

@javagossip
Copy link

这种可以直接创建一个xxx-commons的模块,这些工具类可以放到这个模块里,其他domain/application/inf模块都可以依赖这个模块

@youngledo
Copy link

一些工具类,比如MD5Utils,JSONUtils,DateUtils,这些放在哪一层呢?正常来说是放在infrastructure层的module,但domain曾不依赖任何module, 导致domain中无法使用这些工具类,但如果把这些工具类放在domain层,感觉又不符合分层原理。有没有大神遇到类似的问题?

理论上,不应该存在这些Utils,难道Apache的Commons不够你用吗,还要自己去造轮子,你造的轮子就更好吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants