Java Project Template
We are starting to build a large middle tier java application (we开发者_如何学Gobservices, etc.,). I want to create a template project, so it can used for any other future projects.
Here is what i am thinking of defining in the template project:
- Caching mechanism (for look up and other meta information)
- Exception handling
- Logging
- Needed third party frameworks (build, test, spring) any thing else that can be included here?
I am looking for expert suggestions on each of these areas: 1)
- I am thinking ehCache, any comments on this? positives, negatives or alternatives?
- I dont want developers just to use blanket try/catch blocks.. some mechanism to automatically catch those and log it and configure in a way we want. any suggestions?
- log4j
- I think i will go with Maven, JUnit and Spring; any other 3rd party frameworks worth considering? I dont want to discuss maven versus ant, etc.,
Thank you,
Exception Handling: If you pick spring framework then you would get some help in this regards
- I say spring provides exception translation for persistence layer so no boiler plate code
- I think if you cannot recover and finish the task on hand why not just make it a RuntimeException
- I am not big fan of expressing a business rule as an exception (ex: PatientNotFoundException just from my personal experience)
Log4j: I would just say use slf4j abstraction
Maven: I think Maven is a good build tool as any, I would recommend you to look into Gradle, Since it is a new project it might be worth while to have a look
I would also add that, It is worth while to invest some time into Continuous Integration and tools like Jenkins or Bamboo
精彩评论