resource injection in java EE webservice

Discussion in 'Java' started by gk, Sep 27, 2010.

  1. gk

    gk Guest

    what is a resource injection in java EE webservice ?

    Could you provide some information on this.

    What kind of resources are injected ?

    Are these resources injected AFTER the Webservice is deloyed in the
    JVM ?
    gk, Sep 27, 2010
    #1
    1. Advertising

  2. gk wrote:
    > what is a resource injection in java EE webservice ?
    >
    > Could you provide some information on this.
    >
    > What kind of resources are injected ?
    >
    > Are these resources injected AFTER the Webservice is deloyed in the
    > JVM ?


    I can't speak for anyone else, but before I get into a lot of details, are
    you reasonably comfortable with "dependency injection" in general?

    AHS
    --
    The difference between a moral man and a man of honor is that the
    latter regrets a discreditable act, even when it has worked and he has
    not been caught. -- H.L. Mencken
    Arved Sandstrom, Sep 27, 2010
    #2
    1. Advertising

  3. gk

    gk Guest

    Re: resource injection in java EE webservice

    On Sep 27, 2:29 pm, "Arved Sandstrom" <> wrote:
    > gk wrote:
    > > what is a resource  injection in java EE webservice ?

    >
    > > Could you provide some information on this.

    >
    > > What kind of resources are injected ?

    >
    > > Are these resources injected  AFTER the Webservice is deloyed in the
    > > JVM ?

    >
    > I can't speak for anyone else, but before I get into a lot of details, are
    > you reasonably comfortable with "dependency injection" in general?


    Thanks for the post.

    Yes. I am comfortable with "dependency injection" . I have gone
    through that section in Spring Framework . setter Injection and
    Constructor Injection .

    However, my query is on resource injection (not dependency injection).
    I don't think resource injection = dependency injection. I did not
    find a suitable match in google. I wish to know this wording meaning.
    gk, Sep 27, 2010
    #3
  4. gk

    Lew Guest

    Re: resource injection in java EE webservice

    gk wrote:
    > Yes. I am comfortable with "dependency injection" . I have gone
    > through that section in Spring Framework . setter Injection and
    > Constructor Injection .


    I have come to detest Spring.

    > However, my query is on resource injection (not dependency injection).


    Stop! Think for a minute! Do you really think Arved would have mentioned it
    if it weren't relevant? Resource injection /is/ dependency injection, where
    the dependency is a resource.

    > I don't think resource injection = dependency injection. I did not
    > find a suitable match in google. I wish to know this wording meaning.


    Resource injection is dependency injection, where the dependency injected is a
    resource handler (well, a pointer to the handler).

    See the documentation at
    <http://download.oracle.com/javase/6/docs/api/javax/annotation/Resource.html>
    for example.

    JPA uses resource injection - the '@PersistenceContext' annotation, for
    example, injects a reference to a connection manager instance. (The runtime
    environment must support this, as with all dependency injection.)

    Have you considered taking a Java course, perhaps at a local community
    college? Is that available to you?

    I commend you for your persistence in learning Java.

    --
    Lew
    Lew, Sep 27, 2010
    #4
  5. gk

    gk Guest

    Re: resource injection in java EE webservice

    On Sep 27, 5:07 pm, Lew <> wrote:
    > gk wrote:
    > > Yes. I am comfortable with "dependency injection" . I have gone
    > > through that section in Spring Framework .  setter Injection and
    > > Constructor Injection .

    >
    > I have come to detest Spring.
    >
    > > However, my query is on resource injection (not dependency injection).

    >
    > Stop!  Think for a minute!  Do you really think Arved would have mentioned it
    > if it weren't relevant?  Resource injection /is/ dependency injection, where
    > the dependency is a resource.
    >
    > > I don't think resource injection = dependency injection.  I did not
    > > find a suitable match in google. I wish to know this wording meaning.

    >
    > Resource injection is dependency injection, where the dependency injected is a
    > resource handler (well, a pointer to the handler).


    my question was "what is a resource injection in java EE webservice"

    where this stuff is used in in java EE webservice ? I have done web
    service coding using AXIS and Weblogic. I've not come across this
    stuff. Do we really do resource injection in web service ? This is
    the part I'm not clear.
    gk, Sep 27, 2010
    #5
  6. gk

    Lew Guest

    Re: resource injection in java EE webservice

    On 09/27/2010 08:18 AM,
    gk wrote:
    >>> Yes. I am comfortable with "dependency injection" . I have gone
    >>> through that section in Spring Framework . setter Injection and
    >>> Constructor Injection .


    Lew wrote:
    >> I have come to detest Spring.


    gk wrote:
    >>> However, my query is on resource injection (not dependency injection).


    Lew wrote:
    >> Stop! Think for a minute! Do you really think Arved would have mentioned it
    >> if it weren't relevant? Resource injection /is/ dependency injection, where
    >> the dependency is a resource.


    gk wrote:
    >>> I don't think resource injection = dependency injection. I did not
    >>> find a suitable match in google. I wish to know this wording meaning.


    Lew wrote:
    >> Resource injection is dependency injection, where the dependency injected is a
    >> resource handler (well, a pointer to the handler).


    gk wrote:
    > my question was "what is a resource injection in java EE webservice"


    You'll find that question a lot easier to answer if you eliminate incorrect
    ideas, which I was helping you do. You seem resistant to the answers people
    are giving you in this thread.

    > where this stuff is used in in java [sic] EE webservice ? I have done web


    The name of the language is spelled "Java".

    Well, suppose the web service needs to map entities to a persistent store
    (database). It might use the '@PersistenceContext' annotation to inject an
    entity manager, as I mentioned in my last response. Had you done any minimal
    googling whatsoever at all in the least even a bit on the terms in that
    response you likely would have run across this by now.

    > service coding using AXIS and Weblogic. I've not come across this
    > stuff. Do we really do resource injection in web service ? This is
    > the part I'm not clear.


    Yes.

    --
    Lew
    Lew, Sep 27, 2010
    #6
  7. Re: resource injection in java EE webservice

    On 27.9.2010 15:34, Lew wrote:
    > On 09/27/2010 08:18 AM,
    > gk wrote:
    >
    >> service coding using AXIS and Weblogic. I've not come across this
    >> stuff. Do we really do resource injection in web service ? This is
    >> the part I'm not clear.

    >
    > Yes.
    >


    When I last checked resource injection only worked on so called "managed
    objects", meaning only Servlets and EJB 3.x session beans.

    Not in some Web Service POJO's, which they are at least in Axis 1.x.

    Don't know if things have changed since then...

    --
    Water, taken in moderation cannot hurt anybody.
    -- Mark Twain
    Donkey Hottie, Sep 27, 2010
    #7
  8. gk

    Tom Anderson Guest

    Spring was Re: resource injection in java EE webservice

    On Mon, 27 Sep 2010, Lew wrote:

    > gk wrote:
    >
    >> Yes. I am comfortable with "dependency injection" . I have gone through
    >> that section in Spring Framework . setter Injection and Constructor
    >> Injection .

    >
    > I have come to detest Spring.


    Could you, briefly at least, explain why?

    Do you have an opinion on Guice?

    What do you think of autowiring?

    I'm still trying to work out how i feel about dependency injection
    frameworks. There's at least one good idea in there, but there seems to be
    a lot of cruft and madness surrounding it.

    tom

    --
    The cause? Thatcher again. Not for any specific reasons but she's always
    the root of every problem in Britain today. -- Mike
    Tom Anderson, Sep 27, 2010
    #8
  9. Re: Spring was Re: resource injection in java EE webservice

    Tom Anderson wrote:
    > On Mon, 27 Sep 2010, Lew wrote:
    >
    >> gk wrote:
    >>
    >>> Yes. I am comfortable with "dependency injection" . I have gone
    >>> through that section in Spring Framework . setter Injection and
    >>> Constructor Injection .

    >>
    >> I have come to detest Spring.


    > Could you, briefly at least, explain why?
    >

    I don't know what Lew will say, but this link
    (http://www.web4j.com/Criticisms_Drawbacks_Pitfalls_Spring_Rails_PHP.jsp#Spring)
    sure covers all the problems I had with it, not to mention a few more that
    hadn't really begun to irk me before I abandoned Spring. Granted that link
    is a few years old but I doubt they've fixed all the problems - there's too
    many of them.

    Pretty much the main negative impression that I had of Spring, when
    seriously trying to make a go of it maybe half a dozen times over the past
    few years (and mostly with Spring 2.5), was that the team couldn't have made
    the framework more complicated and rambling if they'd tried. The
    over-reliance on XML configuration, as also explained in the link, is a big
    mistake IMO. Also as mentioned in the link, Spring is bloatware: back when
    Spring Security was still Acegi I experimented with that too, and ended up
    needing to pull in ridiculous amounts of JARs...not to mention that the
    configuration for that was clumsy too.

    My belief is that the bad habits of Spring were engrained starting with its
    release in 2002, and it just exploded into more badness. Java EE 5 and 6,
    IMO, have eliminated any possible residual attraction that Spring may have
    had.

    > Do you have an opinion on Guice?
    >
    > What do you think of autowiring?


    Interesting link: http://java.dzone.com/articles/why-you-should-use-springs

    I agree with the guys that don't like it. And yeah, I tried it too. :)

    > I'm still trying to work out how i feel about dependency injection
    > frameworks. There's at least one good idea in there, but there seems
    > to be a lot of cruft and madness surrounding it.
    >
    > tom


    I know what I think the good idea is: for example, being able to get at a
    session bean by using @EJB and declaring an instance variable to the
    interface, rather than doing a JNDI lookup and a
    PortableRemoteObject.narrow(). And so on and so forth. It's saving me some
    boilerplate.

    Because that's pretty much all *I* want - maybe a few dozen "macros" - I
    have very little patience for something like Spring that makes it so bloody
    complicated.

    AHS
    --
    The difference between a moral man and a man of honor is that the
    latter regrets a discreditable act, even when it has worked and he has
    not been caught. -- H.L. Mencken
    Arved Sandstrom, Sep 27, 2010
    #9
  10. gk

    Arne Vajhøj Guest

    Re: Spring was Re: resource injection in java EE webservice

    On 27-09-2010 16:40, Tom Anderson wrote:
    > On Mon, 27 Sep 2010, Lew wrote:
    >> gk wrote:
    >>> Yes. I am comfortable with "dependency injection" . I have gone
    >>> through that section in Spring Framework . setter Injection and
    >>> Constructor Injection .

    >>
    >> I have come to detest Spring.

    >
    > Could you, briefly at least, explain why?


    Original Spring is a very good concept. It is based on KISS
    and is easy to integrate in your app. You use Spring to make
    loading of module configurable and thereby decouple those
    components.

    That was in 2003-2004.

    Since then Spring has evolved into a huge monster framework
    based on a "if anybody has a Foobar type library, then we need
    a SpringFoobar" philosophy.

    There is actually nothing wrong in still loading 10 classes
    based on a XML config file to avoid coupling.

    But when you take a app and decide to use 20 different Spring
    this and that, then it becomes a big ugly mess.

    Arne
    Arne Vajhøj, Sep 27, 2010
    #10
  11. gk

    Lew Guest

    Re: Spring was Re: resource injection in java EE webservice

    On 09/27/2010 06:36 PM, Arved Sandstrom wrote:
    > Tom Anderson wrote:
    >> On Mon, 27 Sep 2010, Lew wrote:
    >>
    >>> gk wrote:
    >>>
    >>>> Yes. I am comfortable with "dependency injection" . I have gone
    >>>> through that section in Spring Framework . setter Injection and
    >>>> Constructor Injection .
    >>>
    >>> I have come to detest Spring.

    >
    >> Could you, briefly at least, explain why?
    >>

    > I don't know what Lew will say, but this link
    > (http://www.web4j.com/Criticisms_Drawbacks_Pitfalls_Spring_Rails_PHP.jsp#Spring)
    > sure covers all the problems I had with it, not to mention a few more that
    > hadn't really begun to irk me before I abandoned Spring. Granted that link
    > is a few years old but I doubt they've fixed all the problems - there's too
    > many of them.
    >
    > Pretty much the main negative impression that I had of Spring, when
    > seriously trying to make a go of it maybe half a dozen times over the past
    > few years (and mostly with Spring 2.5), was that the team couldn't have made
    > the framework more complicated and rambling if they'd tried. The
    > over-reliance on XML configuration, as also explained in the link, is a big
    > mistake IMO. Also as mentioned in the link, Spring is bloatware: back when
    > Spring Security was still Acegi I experimented with that too, and ended up
    > needing to pull in ridiculous amounts of JARs...not to mention that the
    > configuration for that was clumsy too.
    >
    > My belief is that the bad habits of Spring were engrained starting with its
    > release in 2002, and it just exploded into more badness. Java EE 5 and 6,
    > IMO, have eliminated any possible residual attraction that Spring may have
    > had.
    >
    >> Do you have an opinion on Guice?
    >>
    >> What do you think of autowiring?

    >
    > Interesting link: http://java.dzone.com/articles/why-you-should-use-springs
    >
    > I agree with the guys that don't like it. And yeah, I tried it too. :)
    >
    >> I'm still trying to work out how i feel about dependency injection
    >> frameworks. There's at least one good idea in there, but there seems
    >> to be a lot of cruft and madness surrounding it.
    >>
    >> tom

    >
    > I know what I think the good idea is: for example, being able to get at a
    > session bean by using @EJB and declaring an instance variable to the
    > interface, rather than doing a JNDI lookup and a
    > PortableRemoteObject.narrow(). And so on and so forth. It's saving me some
    > boilerplate.
    >
    > Because that's pretty much all *I* want - maybe a few dozen "macros" - I
    > have very little patience for something like Spring that makes it so bloody
    > complicated.


    What Arved and Arne said. Confronted with Spring projects, I feel like the
    kid who got very excited by a room full of horse manure, exclaiming, "With all
    that shit, there has just /got/ to be a pony in there somewhere!"

    My assessment is based on coming in to existing Spring-based frameworks. The
    latest uses old versions, including the Acegi framework. It's XML hell, but
    not the worst I've seen. The worst used Spring to configure every GUI
    component. You couldn't trace even the simple screen structures for love or
    money. You have Java code that hides a component behind a String that looks
    up a component from an XML description that requires another String to look up
    a nested component that uses a String to find ...

    Too much salt destroys a meal. Too much dependency injection destroys type
    safety, code dependency linkages, readability, maintainability, reason,
    sanity, and your love life.

    I suspect I'd have had a better opinion if the real-world usages hadn't been
    so egregiously mis-engineered. But so far every Spring-based app I've seen
    has had these flaws. It's as if the official tenet of the framework were,
    "Screw you, maintenance programmers!"

    Well, screw Spring! It's ghastly. What's so danged awful about just
    instantiating and using a class instance anyway?

    --
    Lew
    Lew, Sep 28, 2010
    #11
  12. Re: Spring was Re: resource injection in java EE webservice

    On 27-09-2010 21:09, Lew wrote:
    > My assessment is based on coming in to existing Spring-based frameworks.
    > The latest uses old versions, including the Acegi framework. It's XML
    > hell, but not the worst I've seen. The worst used Spring to configure
    > every GUI component. You couldn't trace even the simple screen
    > structures for love or money. You have Java code that hides a component
    > behind a String that looks up a component from an XML description that
    > requires another String to look up a nested component that uses a String
    > to find ...
    >
    > Too much salt destroys a meal. Too much dependency injection destroys
    > type safety, code dependency linkages, readability, maintainability,
    > reason, sanity, and your love life.
    >
    > I suspect I'd have had a better opinion if the real-world usages hadn't
    > been so egregiously mis-engineered. But so far every Spring-based app
    > I've seen has had these flaws. It's as if the official tenet of the
    > framework were, "Screw you, maintenance programmers!"
    >
    > Well, screw Spring! It's ghastly. What's so danged awful about just
    > instantiating and using a class instance anyway?


    To glue layers/components together then it is a fine mechanism. If
    not using Spring we would something else.

    The problem arise when it gets extended not only to be used
    to decouple layers/components but get used to replace the
    new keyword in 1/2 the lines of the entire app.

    Arne
    Arne Vajhøj, Sep 28, 2010
    #12
  13. gk

    gk Guest

    Re: resource injection in java EE webservice

    On Sep 27, 5:34 pm, Lew <> wrote:
    > On 09/27/2010 08:18 AM,
    >
    >
    >
    >
    >
    > gk wrote:
    > >>> Yes. I am comfortable with "dependency injection" . I have gone
    > >>> through that section in Spring Framework .  setter Injection and
    > >>> Constructor Injection .

    > Lew wrote:
    > >> I have come to detest Spring.

    > gk wrote:
    > >>> However, my query is on resource injection (not dependency injection)..

    > Lew wrote:
    > >> Stop!  Think for a minute!  Do you really think Arved would have mentioned it
    > >> if it weren't relevant?  Resource injection /is/ dependency injection, where
    > >> the dependency is a resource.

    > gk wrote:
    > >>> I don't think resource injection = dependency injection.  I did not
    > >>> find a suitable match in google. I wish to know this wording meaning.

    > Lew wrote:
    > >> Resource injection is dependency injection, where the dependency injected is a
    > >> resource handler (well, a pointer to the handler).

    > gk wrote:
    > > my question was "what is a resource  injection in java EE webservice"

    >
    > You'll find that question a lot easier to answer if you eliminate incorrect
    > ideas, which I was helping you do.  You seem resistant to the answers people
    > are giving you in this thread.
    >
    > > where this stuff is used in in java [sic] EE webservice ? I have done web

    >
    > The name of the language is spelled "Java".
    >
    > Well, suppose the web service needs to map entities to a persistent store
    > (database).  It might use the '@PersistenceContext' annotation to inject an
    > entity manager, as I mentioned in my last response.  Had you done any minimal
    > googling whatsoever at all in the least even a bit on the terms in that
    > response you likely would have run across this by now.
    >
    > > service coding using AXIS and Weblogic. I've not come across this
    > > stuff. Do we really do resource  injection in web service ? This is
    > > the part I'm not clear.


    Lew, Could you please do me a favor. Will it be possible for you not
    to answer my post ? I'd be happy if you kindly not post response to my
    post. you are free not to post any response to my post.Please don't
    hijack my post. Don't waste your time .Use your valuable time with
    some meaningful work you like. No offence . No arguments please .
    This is a request .Thanks for all your time and responses.

    It seems to me you are more interested in abuses than answering to the
    original post. Fortunately, here I have found some gentle,helpful and
    knowledgeable persons who are ready to help. Please let them post
    their comments .I don't find your post helpful rather attacking
    attitude. Also, There have been several occurances where you have
    posted wrong information. That was very much unfortunate.Kindly,
    please don't hijack my post next time.

    Thanks for your time.
    gk, Sep 28, 2010
    #13
  14. gk

    Lew Guest

    Re: resource injection in java EE webservice

    gk wrote:
    > It seems to me you are more interested in abuses than answering to the


    You misunderstand. I mean no harm.

    > original post. Fortunately, here I have found some gentle,helpful and
    > knowledgeable persons who are ready to help. Please let them post
    > their comments .I don't find your post helpful rather attacking
    > attitude. Also, There have been several occurances where you have
    > posted wrong information. That was very much unfortunate.Kindly,
    > please don't hijack my post next time.


    You misrepresent my actions. This is a discussion group. You are correct
    that sometimes I made mistakes. That happens, and I apologize for them. But
    I have also given you some good information, which you seem not to mention,
    and you have to understand that I make recommendations to help you. For
    example, we who voluntarily engage in your questions, out of no compensation
    than the pleasure of interacting about a language in which we're all
    interested, would appreciate it if you would follow through on the answers we
    give. That means, in good measure, using search engines and documentation to
    look up more information than we can give here. If you find that suggestion
    insulting, too bad for you, because that's good advice right there.

    I'm truly sorry you don't like my posts. You should try interpreting them
    better, though. I'm not attacking you - I'm always like this.

    As for the quality of my responses, I just reviewed what I've said in this
    "resource injection" thread and I don't see your problem with the information
    I've given. So drop the hostility and let's all continue to play together.

    --
    Lew
    Lew, Sep 28, 2010
    #14
  15. gk

    Lew Guest

    Re: resource injection in java EE webservice

    gk wrote:
    > It seems to me you are more interested in abuses than answering to the


    The thing I find really peculiar about your reaction is that the only personal
    remark I've made to you was a compliment. How you turn a compliment into
    "abuses" puzzles me.

    On 09/27/2010 08:07 AM, Lew wrote:
    >> I commend you for your persistence in learning Java.


    Yeah, that's abusive.

    Not.

    --
    Lew
    Lew, Sep 29, 2010
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dirc Khan-Evans
    Replies:
    1
    Views:
    882
    Karl Seguin
    Oct 17, 2005
  2. Mr. x
    Replies:
    2
    Views:
    701
    Andrew
    Oct 10, 2003
  3. avishosh
    Replies:
    2
    Views:
    10,526
    avishosh
    Aug 8, 2004
  4. Heinrich Moser
    Replies:
    1
    Views:
    447
    Heinrich Moser
    Mar 27, 2008
  5. Alberto Sfolcini

    Spring injection with java annotation?

    Alberto Sfolcini, Apr 24, 2008, in forum: Java
    Replies:
    6
    Views:
    2,215
    Alberto Sfolcini
    Apr 30, 2008
Loading...

Share This Page