Java “什么是”呢;“价值”;在@Service注释中使用
这两者有什么区别Java “什么是”呢;“价值”;在@Service注释中使用,java,spring,annotations,Java,Spring,Annotations,这两者有什么区别 @Service(value="test1") @Service("test1") 没有区别,但是如果注释将使用多个参数,并且您希望使用多个参数,则需要使用“value=“-语法”。有关参数的用法,请参阅-javadoc,或者只查看注释类: public @interface Service { /** * The value may indicate a suggestion for a logical component name, * t
@Service(value="test1")
@Service("test1")
没有区别,但是如果注释将使用多个参数,并且您希望使用多个参数,则需要使用“value=“-语法”。有关参数的用法,请参阅-javadoc,或者只查看注释类:
public @interface Service {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
String value() default "";
}
它被称为“值”的原因以及您可以忽略它的原因可以从以下内容中找到:
允许省略该元素
a中的名称和等号(=)
单元素注释
元素名为value