Announcement Announcement Module
No announcement yet.
stange behaviour trying to instantiante bean Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • stange behaviour trying to instantiante bean

    I'm getting a weird error trying to create a bean called 'values'. Here are the some of the things of note:

    - if I comment out that bean definition in my bean config, then I get a NullPointerException in a class which autowires a field called 'values'. This is what I would expect, since the bean needs to be instantiated through the config in order to be autowired.
    - when I uncomment the bean, none of its properties are getting set, which ends up causing a NullPointerException in the Values() constructor, which triggers a BeanCreationException. This shows that the bean definition is indeed being read from my config.
    - when I add non-existant properties to the bean definition for 'values', there is no error. This is strange.
    - when I add a syntax error to the bean definition, it triggers an error.

    So it seems that the bean definition is being read from the config file, but its properties are not being obeyed. Any ideas what could be wrong?


  • #2
    ...forgot to mention

    I forgot to mention that the Values class also has a setSchema() property which is annotated as @Required. But the '@Required' is not being obeyed, because when I don't put any properties in the bean definition, Spring still tries to construct the bean.