I'm creating a maven modules of spring + jersey+ mybatis application in a jboss server. Currently i have the following structure
app-parent
| \
| \_ app-module1
|____ app-module2
|____ app-module3
|____ app-lib
Each of the app-module* has the dependency of app-lib, and each of the app-module* does not refer to any other app-module*. All the DAOs, Services etc., should be contained within itself, except the app-lib(utilities, logging etc.,).
Note: Jboss datasource has a jndi name app.module.ds
.
-> Now the question is, what is the best way to configure the spring datasource
bean for this type of application?
Which one is better? and why?
As always, it depends on your needs.
If each component is a separated application and although are going to work together but not mixed, like in a micro-services fashion, then is better to have separated datasource configurations.
If the modules are going to work together and mixed as one big main application, then you want to configure the transactions, AOP service, logging, security, etc. in one single place. Then I think you need to put all of these beans in a single place like your app-lib
module, or better, in a new module to handle these kind of configurations. An easy to read article about cross-cutting concerns .
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.