Skip to content

Commit 926cda2

Browse files
committed
Log warnings when auto-configuration enables an InMemory repository
Resolves #334
1 parent e5802e6 commit 926cda2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spring-cloud-app-broker-autoconfigure/src/main/java/org/springframework/cloud/appbroker/autoconfigure/AppBrokerAutoConfiguration.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
import java.util.List;
2020

21+
import org.slf4j.Logger;
22+
import org.slf4j.LoggerFactory;
23+
2124
import org.springframework.beans.factory.annotation.Autowired;
2225
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
2326
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@@ -81,6 +84,8 @@
8184
@ConditionalOnBean(AppDeployer.class)
8285
public class AppBrokerAutoConfiguration {
8386

87+
private static final Logger LOG = LoggerFactory.getLogger(AppBrokerAutoConfiguration.class);
88+
8489
private static final String PROPERTY_PREFIX = "spring.cloud.appbroker";
8590

8691
/**
@@ -152,6 +157,10 @@ public BrokeredServices brokeredServices() {
152157
@Bean
153158
@ConditionalOnMissingBean(ServiceInstanceStateRepository.class)
154159
public ServiceInstanceStateRepository serviceInstanceStateRepository() {
160+
if (LOG.isWarnEnabled()) {
161+
LOG.warn("The InMemoryServiceInstanceStateRepository is provided for demonstration and testing purposes " +
162+
"only. It is not suitable for production applications!");
163+
}
155164
return new InMemoryServiceInstanceStateRepository();
156165
}
157166

@@ -163,6 +172,10 @@ public ServiceInstanceStateRepository serviceInstanceStateRepository() {
163172
@Bean
164173
@ConditionalOnMissingBean(ServiceInstanceBindingStateRepository.class)
165174
public ServiceInstanceBindingStateRepository serviceInstanceBindingStateRepository() {
175+
if (LOG.isWarnEnabled()) {
176+
LOG.warn("The InMemoryServiceInstanceBindingStateRepository is provided for demonstration and testing " +
177+
"purposes only. It is not suitable for production applications!");
178+
}
166179
return new InMemoryServiceInstanceBindingStateRepository();
167180
}
168181

0 commit comments

Comments
 (0)