Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the exact meaning of invasive? and what makes Spring non-invasive? [closed]

Tags:

I'm new to the spring framework. In most of the Spring tutorials I saw, Spring is described as "non-invasive".

What is meant by invasive? What are the merits of using Spring in Java and what makes it non-invasive?

like image 707
JackVimal Avatar asked Mar 11 '13 07:03

JackVimal


People also ask

What is invasive and non invasive in Spring?

An invasive framework means that you are force to extend one of their classes or implement one of their interfaces. You can see that in frameworks like Struts or EJB2. Spring is not-invasive because avoids that.

Why is Spring non intrusive?

Spring can be non-intrusive meaning you can write components which have no dependency on Spring. However, this require dicipline and in reality, many Spring project introduce dependancies on Spring and how it behaves so IMHO many Spring project don't use it as a non-intrusive container.

What means non invasive?

(NON-in-VAY-siv) In medicine, it describes a procedure that does not require inserting an instrument through the skin or into a body opening. In cancer, it describes disease that has not spread outside the tissue in which it began.

What are beans in the concept of Spring or what are Spring beans?

In Spring, the objects that form the backbone of your application and that are managed by the Spring IoC container are called beans. A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container.

Is spring really non-invasive?

Claiming that Spring is non-invasive is like claiming that the earth is flat. You completely deny reality based on nothing else than your personal bias. Spring is not only invasive to your code base, it is also invasive to your brain.

What is the meaning of invasive?

Define invasive. invasive synonyms, invasive pronunciation, invasive translation, English dictionary definition of invasive. adj. 1. Of, engaging in, or given to armed aggression: an invasive military force. 2. a. Of or relating to a disease or condition that has a tendency to...

What is an invasive framework in Java?

An invasive framework means that you are force to extend one of their classes or implement one of their interfaces. You can see that in frameworks like Struts or EJB2. Spring is not-invasive because avoids that.

What is the difference between invasive and non-invasive devices?

Difference between Invasive & Non-invasive and Intrusive & Non-intrusive. Invasive devices have transducers which come into contact with the flowing fluid. They are also called ‘wetted’ transducers. Non–invasive transducers do not come into contact with the fluid and are placed on the outside of the pipe.


1 Answers

If an IoC container is invasive, it means your code needs to be explicitly aware of dependency injection. For example, in Guice you use the @Inject annotation (and others). These annotations are more standardized than they used to be, which is good - it means with a single set of annotations you can (at least in theory) make your code available for use with various different invasive IoC containers.

With a non-invasive container, you can write your code with no reference to IoC at all... everything is just determined by reflection over members and annotations which would be present even if you weren't using IoC.

There are pros and cons of both invasive and non-invasive containers - being more specific in code can give you more control over some of the details of binding, for example - but it's worth being aware of the difference.

like image 67
Jon Skeet Avatar answered Sep 29 '22 10:09

Jon Skeet