Spring @Required

@Required on setter methods to mark dependencies that we want to populate through XML,Otherwise, BeanInitializationException will be thrown.

@Required
void setColor(String color) {
    this.color = color;
}

<bean class="com.annotations.Bike">
    <property name="color" value="green" />
</bean>

参考:
https://blog.csdn.net/qq_40391739/article/details/83352904
Spring Core Annotations

你可能感兴趣的:(框架,spring,java,mybatis)