0

I walked across many Spring tutorials explaining @Configuration and @Bean annotations, and always the @Bean annotation is put above a method that is returning some Spring bean but never follows the java bean getter standard. for example :

@Bean
public LocalSessionFactoryBean sessionFactory() { ... }

and not

getSessionFactory()

Can anyone explain why is this standard abandoned here?

kryger
  • 12,906
  • 8
  • 44
  • 65
osama yaccoub
  • 1,884
  • 2
  • 17
  • 47

1 Answers1

0

This is because by default bean name will be the same as the method name. Following the java bean getter standard you will end up with bean with name "getSessionFactory".

marians27
  • 311
  • 1
  • 7