Jul 12th, 2011, 01:31 PM
Best practices for annotation-based beans?
I've look at the maven project that I built and decided to break things down into smaller modules to facilitate code-reuse. Conceptually, it is fairly simple to do - break things down into modules with the least dependencies, and have the app provide all the glue logic.
In theory, this works fine. I am able to break apart my code that way for the things I want to split up. My problem that I am running into is Spring annotations.
Although the module itself has no reliance on Spring, annotations such as @Autowire, @Repository, @Transactional make the module spring centric.
I'm not sure of the proper way to proceed. I can eliminate the @Autowire and have the container app do the wiring (using XML or java-based configs), but not sure what to do about the @Repository or @Transactional annotations.
Are there suggestions or best practices as to how to do this?
Tags for this Thread