• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@PostConstruct

 
Marcos Vidolin
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

May I use an @Autowired object from Spring inside my @PostConstruct method?

Tks
[]'s
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that Autowired is used by Spring to construct beans and (no surprise here!) automatically wire them together.

A JSF backing bean, however, is constructed by JSF, not by Spring. The JSF equivalent of @Autowired is @ManagedProperty.

The main functional difference between the 2 annotations is that @ManagedProperty accepts an EL expression instead of simply deducing the source property's bean name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic