I am just trying to understand that any container managed bean can be accessed 
via referenced service or it can be injected into another bean as property. 
This part I am clear of which is as per blueprint definition .

My use case is let's say I have some java class which is not container managed. 
Is it possible to refer container managed bean directly into this class which 
is in same bundle and defined in blueprint? I want to access some of those 
container managed properties in this java class. I can also define this java 
class as bean instance into blueprint as well and inject other bean as property 
but don't want that.

Just trying to understand that only beans can be referred to each other which 
are container managed not outside that scope.
________________________________________
From: Brad Johnson [[email protected]]
Sent: Saturday, October 22, 2016 3:06 PM
To: [email protected]
Subject: Re: cm:managed-properties lookup within bundle

Can you clarify the question a bit? It appears there are two aspects to it and 
I'm not quite sure what you are after.

The properties are normally defined  outside of the scope of the bean and are 
available to all beans using the ${{myproperties}} style of reference.

Is there a particular reason you wouldn't want to just inject the Foo bean into 
the other bean?  If it isn't declared in the blueprint file then it has to be 
instantiated by something else. What is instantiating the bean that you want to 
have access to the Foo bean? It seems like you are trying to make the Foo bean 
some sort of static registry that other beans can access properties from but 
I'm not really sure and I've never tried doing it that way as I've never found 
a need.  Perhaps there is one though. Dunno.

It appears that what you seem to want is to inject all properties into your Foo 
bean?  I've never tried it but suppose it can be done but the question is, why?

Perhaps clarify what it is you are trying to accomplish and less on the 
mechanics of how you are attempting to do with it with the implementation you 
show.


Brad



On Thu, Oct 20, 2016 at 9:19 AM, Niten Aggarwal 
<[email protected]<mailto:[email protected]>> wrote:
Hi All,

Is there any way to access container managed bean inside java class of same 
bundle directly without giving it as a reference to service? The java class is 
not a managed bean neither service.
How to access below Foo class inside a class which is not blueprint managed.

        <bean id="component-managed" 
class="org.apache.aries.blueprint.sample.Foo">
               <cm:managed-properties 
persistent-id="blueprint-sample-managed.component"
                       update-strategy="component-managed" 
update-method="update" />
        </bean>






::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.
----------------------------------------------------------------------------------------------------------------------------------------------------

Reply via email to