What is a good project structure for an Across module?
A module should never conflict with another module. As such, there are some best practices for creating a module:
- Put every module in its own discrete package; avoid package overlap with other modules.
@AcrossDepends dependencies to other modules you require.
- Avoid cyclic dependencies on other modules.
- Avoid cyclic package dependencies with other modules (this is where putting them in separate JARs can help, as boundaries become explicit).
- Avoid relying on the ordering of modules you do not have a required dependency on.
- Always rely on ordering of modules you have required dependencies on: these will be started before your own module.
- Define a unique module name and a unique resources key; avoid resource overlap with other modules.
- Put all your module resources in a location mapped with the resources key.
MyModule module descriptor would be in package
- All components would be in either
com.foo.modules.my or a child package.
- The basic configuration classes would be in
- If the resources key of the module would be
my, then all embedded resources would be in a location containing that key, for example:
/messages/my/default.properties (message code)
/installers/my (installer files)
/static/my (static resources)
/th/my (Thymeleaf templates)