原帖位于IT老兵博客

正文

总结整理一下spring的@configuration和@Bean。

参考这里,这个网站有不少挺好的对于技术的解释性文章。

Annotating a class with the @Configuration indicates that the class can be used by the Spring IoC container as a source of bean definitions.

@Configuration意味着这个被注解的类可以被Spring IoC container(Spring IoC 容器)作为一个bean定义的来源,就是在启动时,让容器去扫描这里,加载底下的对象。

The @Bean annotation tells Spring that a method annotated with @Bean will return an object that should be registered as a bean in the Spring application context.

@Bean意味着被它注解的方法将会返回一个对象,可以被作为bean注册在Spring application的context中。

参考

https://www.tutorialspoint.com/spring/spring_java_based_configuration.htm

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2021-07-27
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2021-10-13
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
相关资源
相似解决方案