Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6993331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:45:03+00:00 2026-05-27T19:45:03+00:00

I was working for a few months on the project without even noticing this,

  • 0

I was working for a few months on the project without even noticing this, and yesterday, after editing a class file (inserting new dependency bean with its getter/setter), I forgot to explicitly add:

<property name="deviceService" ref="deviceService"/>

in the appropriate spring context xml.
I publshed my web app to tomcat, entered debug, and the moment I saw the line of code using this service bean, I realized that I forgot to declare it as the dependecy.
But then, strange thing happend – the bean was injected nevertheless…
This behaviour confuses me a bit. I’m surely not a spring expert, I’ve been using it for the past several months, however this is not something that I expected to be possible. The name of the class field, as it can be seen, is the same as bean that is being injected, if that matters. In the debugger I saw something like this for the dependency field:

deviceService=$Proxy5 (id=107)
   * h=JdkDynamicAopProxy (id=147)

so I’m guessing it has to do something with spring AOP.

I must add that I didn’t start this project form scratch, it was already configured, it uses spring-aop for transactions demarcation, and some logging purposes.

EDIT
Some additional info: project integrates ZK Ajax and Hibernate as well. This service bean is basically a wrapper around a DAO bean; DAO bean is in turn a wrapper around spring’s HibernateTemplate. Service and DAO beans are singleton-scoped. Service that is being injected is injected into the prototype-scoped MVC controller bean. Service bean is from the package used for DB transaction demarcation:

<tx:advice id="serviceTxAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <tx:method name="*" propagation="REQUIRED" />
    </tx:attributes>
</tx:advice>

<aop:config>
    <aop:pointcut id="serviceMethodsRMS"
        expression="execution(* org.irvas.amregina.backend.service.*.*(..))" />
    <aop:advisor advice-ref="serviceTxAdvice" pointcut-ref="serviceMethodsRMS" />
</aop:config>

So, can anyone explain to me what is going on, or what could be the reason for this?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:45:04+00:00Added an answer on May 27, 2026 at 7:45 pm

    On the root beans tag of the xml there is an attribute default-autowire-byname / default-autowire-bytype. If that is set to true then spring will inject the dependencies automatically. By default it is set to false – I am guessing that in your case one of the above flag is set to true.

    AOP is not involved in dependency injection. You are seeing the proxy because the object that is being injected is using some feature of spring that needs aop (like transaction , security etc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was working on a project a few months ago, and had the need
A few months ago, I was working on a PHP project in Aptana Studio.
I have been working on a project for a few months now and my
I am upgrading a project I had working previously. This code worked a few
We have been working on a project for several months without any problems until
I've been working on a java spring project for a few months now. I
One day ago, after a few months of normal working, our java app starts
Hi I've been working with Django for a few months and find it really
I've been working on this for a few days now, and I've found several
I am flex developer, and from last few months, i am continuously working on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.