浏览代码

Add DEFAULT_USER_SCHEMA_DDL_LOCATION constant

Closes gh-10837
Eleftheria Stein 3 年之前
父节点
当前提交
a2d1965c25

+ 2 - 0
core/src/main/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImpl.java

@@ -110,6 +110,8 @@ import org.springframework.util.Assert;
  */
 public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService, MessageSourceAware {
 
+	public static final String DEFAULT_USER_SCHEMA_DDL_LOCATION = "org/springframework/security/core/userdetails/jdbc/users.ddl";
+
 	// @formatter:off
 	public static final String DEF_USERS_BY_USERNAME_QUERY = "select username,password,enabled "
 			+ "from users "

+ 2 - 2
docs/modules/ROOT/pages/servlet/authentication/passwords/jdbc.adoc

@@ -113,7 +113,7 @@ In our example, we set up an https://docs.spring.io/spring-framework/docs/curren
 DataSource dataSource() {
 	return new EmbeddedDatabaseBuilder()
 		.setType(H2)
-		.addScript("classpath:org/springframework/security/core/userdetails/jdbc/users.ddl")
+		.addScript(JdbcDaoImpl.DEFAULT_USER_SCHEMA_DDL_LOCATION)
 		.build();
 }
 ----
@@ -133,7 +133,7 @@ DataSource dataSource() {
 fun dataSource(): DataSource {
     return EmbeddedDatabaseBuilder()
         .setType(H2)
-        .addScript("classpath:org/springframework/security/core/userdetails/jdbc/users.ddl")
+        .addScript(JdbcDaoImpl.DEFAULT_USER_SCHEMA_DDL_LOCATION)
         .build()
 }
 ----