Add auto config for Spring Cloud Azure Event Hub
This commit is contained in:
Родитель
a2203389be
Коммит
c53923f28a
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for
|
||||
* license information.
|
||||
*/
|
||||
|
||||
package com.microsoft.azure.spring.cloud.autoconfigure.eventhub;
|
||||
|
||||
import com.microsoft.azure.management.eventhub.EventHub;
|
||||
import com.microsoft.azure.spring.cloud.autoconfigure.context.AzureContextAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* An auto-configuration for Event Hub
|
||||
*
|
||||
* @author Warren Zhu
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureAfter(AzureContextAutoConfiguration.class)
|
||||
@ConditionalOnClass(EventHub.class)
|
||||
@EnableConfigurationProperties(AzureEventHubProperties.class)
|
||||
@ConditionalOnProperty("spring.cloud.azure.event.hub.namespace")
|
||||
public class AzureEventHubAutoConfiguration {
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for
|
||||
* license information.
|
||||
*/
|
||||
|
||||
package com.microsoft.azure.spring.cloud.autoconfigure.eventhub;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* @author Warren Zhu
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.azure.event.hub")
|
||||
public class AzureEventHubProperties {
|
||||
private String namespace;
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче