Commit 0897cfb5 authored by Phillip Webb's avatar Phillip Webb

Deprecate and warn on namingstrategy

Deprecate setNamingstrategy() and log a warning letting people know
that they should use `naming-strategy`.

Issue #928
parent 3457cc4f
...@@ -21,6 +21,8 @@ import java.util.Map; ...@@ -21,6 +21,8 @@ import java.util.Map;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDatabaseConnection; import org.springframework.boot.autoconfigure.jdbc.EmbeddedDatabaseConnection;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.SpringNamingStrategy; import org.springframework.boot.orm.jpa.SpringNamingStrategy;
...@@ -28,7 +30,7 @@ import org.springframework.orm.jpa.vendor.Database; ...@@ -28,7 +30,7 @@ import org.springframework.orm.jpa.vendor.Database;
/** /**
* External configuration properties for a JPA EntityManagerFactory created by Spring. * External configuration properties for a JPA EntityManagerFactory created by Spring.
* *
* @author Dave Syer * @author Dave Syer
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.1.0 * @since 1.1.0
...@@ -36,6 +38,8 @@ import org.springframework.orm.jpa.vendor.Database; ...@@ -36,6 +38,8 @@ import org.springframework.orm.jpa.vendor.Database;
@ConfigurationProperties(prefix = "spring.jpa") @ConfigurationProperties(prefix = "spring.jpa")
public class JpaProperties { public class JpaProperties {
private static final Log logger = LogFactory.getLog(JpaProperties.class);
private Map<String, Object> properties = new HashMap<String, Object>(); private Map<String, Object> properties = new HashMap<String, Object>();
private String databasePlatform; private String databasePlatform;
...@@ -100,7 +104,6 @@ public class JpaProperties { ...@@ -100,7 +104,6 @@ public class JpaProperties {
* Get configuration properties for the initialization of the main Hibernate * Get configuration properties for the initialization of the main Hibernate
* EntityManagerFactory. The result will always have ddl-auto=none, so that the schema * EntityManagerFactory. The result will always have ddl-auto=none, so that the schema
* generation or validation can be deferred to a later stage. * generation or validation can be deferred to a later stage.
*
* @param dataSource the DataSource in case it is needed to determine the properties * @param dataSource the DataSource in case it is needed to determine the properties
* @return some Hibernate properties for configuration * @return some Hibernate properties for configuration
*/ */
...@@ -110,7 +113,6 @@ public class JpaProperties { ...@@ -110,7 +113,6 @@ public class JpaProperties {
/** /**
* Get the full configuration properties for the Hibernate EntityManagerFactory. * Get the full configuration properties for the Hibernate EntityManagerFactory.
*
* @param dataSource the DataSource in case it is needed to determine the properties * @param dataSource the DataSource in case it is needed to determine the properties
* @return some Hibernate properties for configuration * @return some Hibernate properties for configuration
*/ */
...@@ -137,7 +139,10 @@ public class JpaProperties { ...@@ -137,7 +139,10 @@ public class JpaProperties {
this.namingStrategy = namingStrategy; this.namingStrategy = namingStrategy;
} }
@Deprecated
public void setNamingstrategy(Class<?> namingStrategy) { public void setNamingstrategy(Class<?> namingStrategy) {
logger.warn("The property spring.jpa.namingstrategy has been renamed, "
+ "please update your configuration to use nameing-strategy");
this.setNamingStrategy(namingStrategy); this.setNamingStrategy(namingStrategy);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment