Announcement Announcement Module
Collapse
No announcement yet.
@Configurable and @Autowired Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Configurable and @Autowired

    I have two questions, answer(s) will be appreciated -

    1) I was looking into this blog new-improvements-in-domain-object-dependnecy-injection-feature/. It says if a domain object is annotated with @Configurable, then on instantiation and deserialization dependencies will be injected automatically. I understand how dependencies will be injected on instantiation, but I did not understand how dependencies will be injected on de-serialization? The important thing is, who is deserializing? If spring container is deserializing (which i am not sure how it will), then it makes sense, then spring can pass the object through AutowireCapableBeanFactory to inject dependencies. But if developer is deserializing himself, then how dependencies will be injected? On second case, spring does not know about deserialized object to inject dependencies, right?

    2) If a bean implements ApplicationContextAware to get application context, and if another bean uses @Autowired on ApplicationContext member variable, then are they same? I am looking for an answer like, saying both are OK and both are suggested way. Or may be something like, do this, but don't do the other one, that is bad for bla bla reason.

    Thanks
Working...
X