-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Comments
这种可以直接创建一个xxx-commons的模块,这些工具类可以放到这个模块里,其他domain/application/inf模块都可以依赖这个模块 |
理论上,不应该存在这些Utils,难道Apache的Commons不够你用吗,还要自己去造轮子,你造的轮子就更好吗? |
我也是新增了一个common层,其他层都可以引用的,但是个人感觉还是可以将所有能用到的工具类封装成jar包,引用即可,比如常用的Hutool,或者其他包 |
都沉到 infra 层,然后 infra 内部消化,对外调用 gateway 就好了, 你总不能在 app 层还搞各种 Util 吧?那还分层个啥? |
直接建common module就行了,把它们当作jdk util,三方包一样 |
一些工具类,比如MD5Utils,JSONUtils,DateUtils,这些放在哪一层呢?正常来说是放在infrastructure层的module,但domain曾不依赖任何module, 导致domain中无法使用这些工具类,但如果把这些工具类放在domain层,感觉又不符合分层原理。有没有大神遇到类似的问题?
The text was updated successfully, but these errors were encountered: