Spring 是否可以从注释中读取YAML属性?

Spring 是否可以从注释中读取YAML属性?,spring,spring-boot,spring-data-jpa,Spring,Spring Boot,Spring Data Jpa,我需要将db shchema传递给注释,是否可以在不创建中间变量的情况下从注释中读取 诸如此类- @Id @SequenceGenerator(name = "${DB_ESCHEMA} + SEQ.ID") private Long id; 不,您不能在JPA注释中使用Spring EL 但是为什么要使用模式名称呢?它与其他表不一样吗?BD用户配置(特权)强制我在所有提交给BD的操作中指定模式名称。您可以全局定义模式spring.jpa.properties.

我需要将db shchema传递给注释,是否可以在不创建中间变量的情况下从注释中读取

诸如此类-

  @Id
  @SequenceGenerator(name = "${DB_ESCHEMA} + SEQ.ID")
  private Long id;

不,您不能在JPA注释中使用Spring EL


但是为什么要使用模式名称呢?它与其他表不一样吗?

BD用户配置(特权)强制我在所有提交给BD的操作中指定模式名称。您可以全局定义模式spring.jpa.properties.hibernate.default\u schema=schema。应用程序使用两个不同模式的BD。