java - Are there Compound property values in Spring -


I read about compound property name ""

I use the same concept to determine the values ​​of properties? Can I use a compound string as a value expression?

  & lt; Bean id = "Service 1" class = "ABC service 1 implied" scope = "prototype" & gt; & Lt; Property Name = "Service 2" Reference = "Service 2" /> & Lt; Property Name = "Service2.User" value = "This service-1-example.user" /> & Lt; / Bean & gt; & Lt; Bean id = "Service 2" class = "a.b.c.Service2Impl" scope = "prototype" & gt; ... & lt; / Bean & gt;  

User is a property of a.b.c.Service1Impl, which is not under spring control. I want to forward this property to abcService2Impl.

Instead of using a plain old factory bean, use a factory method to make the bean of the property And then inject the result ...

Iow

In your case, something like this will appear ...

    

Then the ID is created by calling to create the semin service on the service provider.

Now spring does not support nested properties out of the box, although you can provide a custom editor that can support - possible but difficult. Probably not worth the effort.

A mechanism that you can see using a factory-bean factory-method technique is nesting ...

Something like this:

  & lt; Bean id = "c" square = "c" /> & Lt; Bean id = "b" factory-bean = "c" factory-method = "meet" /> & Lt; Bean id = "a" factory bean = "b" factory-method = "find" />  

This will effectively expose: A.B. C, where A method is found in C. B and A get one method


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -