Announcement Announcement Module
Collapse
No announcement yet.
Can we use Spring without IOC or Dependency of Injection? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Guys,

    Can we use Spring without IOC or Dependency of Injection?




    Thx

  • #2
    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.

    Comment


    • #3
      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?

      Comment


      • #4
        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

        Comment


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

          Comment


          • #6
            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

            Comment


            • #7
              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?

              Comment


              • #8
                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.

                Comment


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

                  Comment


                  • #10
                    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.

                    Comment

                    Working...
                    X