Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 945887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:49:32+00:00 2026-05-15T22:49:32+00:00

Simplified Architecture of Web Projects WAR spring dependency injection (most use XML) JAR DAO

  • 0

Simplified Architecture of Web Projects

  • WAR

    • spring dependency injection (most use XML)
  • JAR

    • DAO
    • Domain

The Problem:
With Spring 3 and 2.5+ annotations building Repositories and services has become much easier to wire together. However, because often a @Service conceptually belongs in the JAR far more than the WAR, and certainly auto-wired Repositories, and transactional classes, do. How do people work where it’s expected to not have “spring dependencies” in the actual JAR classes, which I’ve found in multiple companies is a goal.

Obviously I know you cannot remove ALL spring dependencies if you want to use Annotations and Transactions, since they are actually spring classes, but is there some best practice people use that limit the liability if there are changes to spring, or there are projects that use OLDER spring versions in their WAR than what is included in the JAR?

I’m assuming this must be a common problem, but if not, please ask and I will elaborate

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:49:33+00:00Added an answer on May 15, 2026 at 10:49 pm

    Annotation based dependency injection is essentially a (very convenient) violation of Separation of Concerns. The dependency you describe is the result of this. If you would like to avoid it you should do your wiring in a separate package (i.e. not use annotations for dependency injection).

    It is possible however to wire based on your own custom annotations. Depending on how far you are willing to go this can improve things to leave only a single spring dependency (your extending annotation) or remove the dependencies altogether. This still violates SoC, but with much less dependency on Spring.

    Usually I find that either living with the downsides of annotations, or completely living without them (using Java Config or plain old XML) are the most maintainable options. Custom annotations are another maintenance burden.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I simplified my code to show the problem. When I use this Coffeescript snippet:
A simplified version of problem I am experiencing: Here is my HTML form: <form
Having this (simplified) XML: <?xml version=1.0 encoding=UTF-8?> <kml> <Document> <Placemark> <name>Poly 1</name> <Polygon> <coordinates>
Simplified Question: What's the XPath to select all XML nodes with an attribute that
I am currently developing an architecture in PHP and MySQL and a problem has
I'm using TableProfileProvider to use ASP.NET profile system in an n-layer architecture. The UI
Can I get some constructive feedback about the following architecture? Simplified Architecture Summary: Return
Simplified version of the problem: So I have this query which is inside a
I have the following (simplified) architecture: client(s) --> bouncer --> server The clients send
Problem (simplified to make things clearer): 1. there is one statically-linked static.lib that has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.