Announcement Announcement Module
Collapse
No announcement yet.
beanNames datatype in BeanNameAutoProxyCreator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • beanNames datatype in BeanNameAutoProxyCreator

    How come the injection below work? xml there is list type but in class there is String[] type. So which one is correct?

    //spring reference there is
    In Spring reference there is
    <bean id="autoProxyCreator"
    class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
    <property name="beanNames"><value>jdk*,onlyJdk</value></property>

    //i am using this
    <bean id="autoProxyCreator"
    class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
    <property name="beanNames">
    <list>
    <idref bean="userImpl"/>


    public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator
    {
    private List beanNames;

    public void setBeanNames(String[] beanNames) {
    this.beanNames = Arrays.asList(beanNames);
    }

  • #2
    One of the big features of the core container is to be able to map one type of value into another. Mostly strings into other objects. In this case its mapping a list of strings into an array of strings. But it can do all sorts of things like strings into Class objects. Using custom editors that you register with the ApplicationContext you can convert strings into Date or Timestamp using a particular format.

    What the container does is examine the type of the input data and using reflection and introspection be able to figure out which methods to call, including ones that use overloading. Although at times when there is an ambiguous match, you need to give more detail. This is why you'll see constructor-args often use the index or type attribute.

    Comment


    • #3
      Do you know which page of spring reference can learn this thing? I want to know more clear those types of method?

      Comment


      • #4
        Originally posted by jimmy6
        Do you know which page of spring reference can learn this thing? I want to know more clear those types of method?
        Take a look here:

        http://static.springframework.org/sp...-customeditors
        http://static.springframework.org/sp...-customeditors

        Comment

        Working...
        X