Skip to content

Commit b7efec5

Browse files
committed
Support case insensitive value for Cassandra's SchemaAction
Closes gh-8903
1 parent 4fd9a8c commit b7efec5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfiguration.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -106,8 +106,9 @@ public CassandraSessionFactoryBean session(CassandraConverter converter)
106106
session.setCluster(this.cluster);
107107
session.setConverter(converter);
108108
session.setKeyspaceName(this.properties.getKeyspaceName());
109-
SchemaAction schemaAction = this.propertyResolver.getProperty("schemaAction",
110-
SchemaAction.class, SchemaAction.NONE);
109+
String name = this.propertyResolver.getProperty("schemaAction",
110+
SchemaAction.NONE.name());
111+
SchemaAction schemaAction = SchemaAction.valueOf(name.toUpperCase());
111112
session.setSchemaAction(schemaAction);
112113
return session;
113114
}

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraDataAutoConfigurationIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,8 +72,8 @@ public void hasRecreateSchemaActionSet() {
7272
String cityPackage = City.class.getPackage().getName();
7373
AutoConfigurationPackages.register(this.context, cityPackage);
7474
EnvironmentTestUtils.addEnvironment(this.context,
75-
"spring.data.cassandra.schemaAction:RECREATE_DROP_UNUSED",
76-
"spring.data.cassandra.keyspaceName:boot_test");
75+
"spring.data.cassandra.schemaAction=recreate_drop_unused",
76+
"spring.data.cassandra.keyspaceName=boot_test");
7777
this.context.register(CassandraAutoConfiguration.class,
7878
CassandraDataAutoConfiguration.class);
7979
this.context.refresh();

0 commit comments

Comments
 (0)