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 7672301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:15:15+00:00 2026-05-31T16:15:15+00:00

I have a dao jar file that contains all the domain objects and service

  • 0

I have a dao jar file that contains all the domain objects and service classes. it has a config file dao-resource.xml with id=datasource.

I am using this jar file in another project which has its own app-context.xml, but i want to override the bean with id="datasource" in the jar file

how do i do this. I tried to add a bean with same id in app-context.xml and added both files to classpathxmlapplicat…. first dao-resource.xml then app-context.xml

but that did not seem to work.

how else can i override a bean

  • 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-31T16:15:16+00:00Added an answer on May 31, 2026 at 4:15 pm

    Having spring config files in jars makes things a bit harder to manage. If you have annotated your classes it would be easier.

    But anyway, I’d suggest splitting the dao xml in two parts – your beans, and infrastructure-related beans (like the datasource). Then you can include only the ones you need in your app-context.xml.

    Another way would be to use primary="true" on your overriding bean. This would mean all injection points that need a bean of type DataSource, would pick your primary bean. But that won’t work if you refer to your datasource in your dao xml.

    So in short – you can’t override a bean, so split your xml file and include only the parts you need.

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

Sidebar

Related Questions

I have a number of DAO classes that extend SqlMapClientDaoSupport, and call getSqlMapClientTemplate() to
I have following code: //preparing DAO objects FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(test-context.xml); surveyDao =
I have a service method that calls a DAO which then returns an object
I have DAO's for each table, that all implement an interface. Now I want
Suppose we have following packages in our project org.xxx.dao, org.xxx.service, org.xxx.service.impl all the package
I have two data access objects that are reverse generated and jar'ed up for
I have several DAO objects that are used to retrieve information from a database
My system has this pattern DAO->Objects->facade->View so i have a DAO to query database,
I have a JSP struts application that uses Spring to integrate with the services/dao/database.
Simplified Architecture of Web Projects WAR spring dependency injection (most use XML) JAR DAO

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.