Results 1 to 10 of 10

Thread: Can we use Spring without IOC or Dependency of Injection?

  1. #1

    Default Can we use Spring without IOC or Dependency of Injection?

    Guys,

    Can we use Spring without IOC or Dependency of Injection?




    Thx

  2. #2
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Quote Originally Posted by ford_mustang View Post
    Guys,
    Can we use Spring without IOC or Dependency of Injection?
    Thx
    I guess you can.. but what would be the point of using it??

    But what are your problems with IOC/DI? Maybe we can help you to understand the added value of it.

  3. #3
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Well Spring is modular by design, you can use as little or as much as you like. If you want to just the new operator to create objects instead of letting Spring do it, its possible. But why would you want to?

    What problem are you trying to solve with Spring?

  4. #4

    Default need to be as simple as possible

    guys,

    IOC/Dependency of Injection leads to proliferation of interfaces rite? need to get rid of this.


    thx

  5. #5
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Not quite sure what your getting at. But as I said you can use what you want and leave what you don't.

  6. #6
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Quote Originally Posted by ford_mustang View Post
    guys,
    IOC/Dependency of Injection leads to proliferation of interfaces rite? need to get rid of this.
    thx
    DI is not visible in the interface. The implementation has a constructors/setter to place the dependencies, but this is just an implementation detail (only visible inside the IOC-container). Code doesn't depend on concrete implementations but on interfaces and in the interfaces there are no setters (in most cases) and no constructors. So DI/IOC is not visible in the interface.

    Could you give an example of what you find problematic with IOC/DI

  7. #7
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    Although its recommended to use interfaces with Spring there is no requirement to so. Interfaces allow you to use proxy-based AOP with Spring. But you can certain use CGLIB based proxies if you don't want to use interfaces.

    But why do you need to get rid of interfaces?
    Bill

  8. #8
    Join Date
    Aug 2004
    Location
    Burgas, Bulgaria
    Posts
    37

    Default

    I had a standalone java project where it was useful to map certain pojos to records in a fixed-record file, some of these files containing 900,000 records. Java.nio, all of that, basically mapping pojo properties to fields in a ByteBuffer. I found BeanWrapperImpl and the custompropertyeditor stuff *very* useful for that kind of thing. Given the nature of the project I didn't really need much else from spring.

  9. #9
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    Not that I fully understood your situation - the tea leaves tell me that Jakarta BeanUtils might be a better tool for you here.
    --Jing Xue

  10. #10
    Join Date
    Aug 2004
    Location
    Burgas, Bulgaria
    Posts
    37

    Default

    I went through BeanUtils. For the level of abstraction I needed it just didn't do the trick. CustomPropertyEditors - the spring way of handling them is much better, plus it allows you to configure bean properties, not just the class that the property is. BeanName.propertyName, in that manner.
    I had bean properties that were classes like ZonedDecimal ... things that don't exist in Java.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •