File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Singleton class + DI/IOC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Singleton class + DI/IOC" Watch "Singleton class + DI/IOC" New topic

Singleton class + DI/IOC

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
I am planning to apply logging(log4j) during runtime for my Singleton class using DI/IOC. Can i need Spring AOP / AspectJ for DI ?
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
DI and AOP are orthogonal concepts. I think you want to use AOP, not DI.

So I guess you don't want to have logging code in your singleton class?

SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
Yes, I do not want looging code in DAO class.
I agree. Here's the link:
subject: Singleton class + DI/IOC
Similar Threads
Is OSGI framework a Dependency Injection killer?
Does service locator needs to be a Singleton to cache
Depengency injection and IOC
injection and lookup
IOC Vs DI Vs Factory Pattern