gpt4 book ai didi

spring - Spring bean 的标准命名

转载 作者:IT老高 更新时间:2023-10-28 13:54:33 27 4
gpt4 key购买 nike

有人知道 App 上下文中 Spring bean 的标准命名吗?

我使用 Camel 案命名,但我不确定是否存在某种标准,我在网上搜索过但我没有找到。

最佳答案

Bean Naming Conventions (Spring Framework Reference section 1.3.1)

The convention is to use the standard Java convention for instance field names when naming beans. That is, bean names start with a lowercase letter, and are camel-cased from then on. Examples of such names would be (without quotes) 'accountManager', 'accountService', 'userDao', 'loginController', and so forth.

Naming beans consistently makes your configuration easier to read and understand, and if you are using Spring AOP it helps a lot when applying advice to a set of beans related by name.

关于spring - Spring bean 的标准命名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5314513/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com