tag:blogger.com,1999:blog-3237724005744642470.post7360006401737029186..comments2020-12-06T09:07:04.400+00:00Comments on Captain Debug's Blog: The Strategy PatternRoger Hugheshttp://www.blogger.com/profile/07042290171112551665[email protected]Blogger2125tag:blogger.com,1999:blog-3237724005744642470.post-60368678612261997792012-04-06T16:47:39.586+01:002012-04-06T16:47:39.586+01:00HI, using @Qualifier("Visa") will NOT e...HI, using @Qualifier("Visa") will NOT enforce the use of the Visa compile time, it'll enforce the use of the Visa object at load time - meaning that Spring will inject the Visa object as a default payment method when it loads all your classes. You can, of course, add a setter to the SpringShoppingCart object and change the payment method as many times as you like during runtime. <br /><br />This example really just demonstrates that you can inject a strategy class in different ways and that Strategy is a common pattern used by The Guys at Spring.Roger Hugheshttps://www.blogger.com/profile/07042290171112551665[email protected]tag:blogger.com,1999:blog-3237724005744642470.post-69009627202719474022012-04-05T09:13:27.308+01:002012-04-05T09:13:27.308+01:00By using @Qualifier("Visa") you enforce ...By using @Qualifier("Visa") you enforce the use of the Visa implementation at compile time, what if the customer wants to use another payment method at runtime ?Anonymous[email protected]