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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:19:24+00:00 2026-06-11T15:19:24+00:00

I have a core module with a class that contains: @Autowired private BaseDao dao;

  • 0

I have a core module with a class that contains:

@Autowired
private BaseDao dao;

and few implementations of BaseDao interface:

class JdbcBaseDaoImpl implements BaseDao {...}
class HibernateBaseDaoImpl implements BaseDao {...}

And few modules which use that class from the core module (using maven).
But in the first module, I want to use JdbcBaseDaoImpl implementation in that field of core module and in the second module, to use HibernateBaseDaoImpl implementation.

How to do that? In other words, how to use class in core module with

@Autowired
@Qualifier("jdbcBaseDaoImpl")
private BaseDao dao;

in first module and

@Autowired
@Qualifier("hibernateBaseDaoImpl")
private BaseDao dao;

in second module?

  • 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-06-11T15:19:25+00:00Added an answer on June 11, 2026 at 3:19 pm

    The annotation is @Qualifier("<name>"). See this for more details.

    BTW, the Java EE equivalent of this is @Resource(name="<name>").

    If these modules are going to run in the same process space, then it is not possible to conditionally inject different implementations into the same variable in core module based on the code path. You can instead push the BaseDao reference into the dependent modules, inject the appropriate one for each and pass it as a reference to the core module’s method that need it.

    If these modules are going to run in different process space, then you can configure the appropriate implementation for each module, in the process specific spring configuration file (This we do for separating the implementations for production and unit test stages).

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

Sidebar

Related Questions

I have a core data object and a REST web interface that use different
I have a CORE class that pertains only to my specific site, ie, it
I have a module called user_searches. It performs some searches that aren't core to
I have a Preference class (module) that's used across several different apps. Basically it's
I have a jar compiled with core jdk. It contains a java class which
I have a Core Data class Meeting with a property date which I want
I have a Core Data based mac application that is working perfectly well until
I'm having a problem using methods in my module's model class. I have a
I have an <mx:Application> which contains a <mx:Module> . This module has several child
I have a method in my class that takes a parameter that's a number.

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.