SpringCloud Schema注冊服務(wù)器

2023-11-27 13:52 更新

Spring Cloud Stream提供了模式注冊表服務(wù)器實現(xiàn)。要使用它,可以將spring-cloud-stream-schema-server工件添加到項目中,并使用@EnableSchemaRegistryServer批注,該批注將架構(gòu)注冊表服務(wù)器REST控制器添加到您的應(yīng)用程序。該注釋旨在與Spring Boot web應(yīng)用程序一起使用,并且服務(wù)器的偵聽端口由server.port屬性控制。spring.cloud.stream.schema.server.path屬性可用于控制模式服務(wù)器的根路徑(尤其是當(dāng)它嵌入在其他應(yīng)用程序中時)。spring.cloud.stream.schema.server.allowSchemaDeletion布爾屬性可以刪除模式。默認(rèn)情況下,這是禁用的。

架構(gòu)注冊表服務(wù)器使用關(guān)系數(shù)據(jù)庫來存儲架構(gòu)。默認(rèn)情況下,它使用嵌入式數(shù)據(jù)庫。您可以使用Spring Boot SQL數(shù)據(jù)庫和JDBC配置選項來自定義模式存儲。

以下示例顯示了一個啟用架構(gòu)注冊表的Spring Boot應(yīng)用程序:

@SpringBootApplication
@EnableSchemaRegistryServer
public class SchemaRegistryServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(SchemaRegistryServerApplication.class, args);
    }
}
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號