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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:29:47+00:00 2026-05-23T09:29:47+00:00

Say that I have class Controller with property strategy of type IStrategy. In Spring,

  • 0

Say that I have class Controller with property strategy of type IStrategy. In Spring, I can create different instances of Controller and inject different strategy implementations by defining beans in xml configuration file as shown below:

<bean id="strategyAController" class="com.test.Controller"> 
    <property name="strategy" ref="strategyAImpl">
</bean>

<bean id="strategyBController" class="com.test.Controller"> 
    <property name="strategy" ref="strategyBImpl">
</bean>

<bean id="strategycController" class="com.test.Controller"> 
    <property name="strategy" ref="strategycImpl">
</bean>

I can then reference these beans using @Autowired and @Qualifier(“strategyAController”), etc. What is the equivalent way of doing this in Java EE 6

  • 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-23T09:29:47+00:00Added an answer on May 23, 2026 at 9:29 am

    Funny you should ask! Gavin King, who designed Java EE 6 CDI, got into a nasty fight with someone on exactly the same problem.

    http://www.tsolak.com/?p=59

    The Spring code, of course, looks awfully like Java. We can do that in java – create some variables, set some properties, no biggie. I am curious, in your perticular application, what’s the drawback of doing it in plain Java? What’s the specific benefit you get from Spring for these beans?

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

Sidebar

Related Questions

Let's say that I have a bunch of class instances that serve different purposes,
Say I have a class ObjectA (a view controller for example), that does this
In some class, let say Class A, I have a property (of type B):
Let's say that I have class , that uses some functionality of dict .
Say that I have an immutable Point class with x and y parameters, and
Lets say that I have the following code: public class Shelter<A extends Animal, B
Okay so let's say I have class A... CLASS A has a method that
Say I have a class that looks like this (get/set omited): class InfoClass{ String
Lets say I have a class A that is fairly simple like this -
Say I have a class which represents a person, a variable within that class

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.