- Spring Security(Third Edition)
- Mick Knutson Robert Winch Peter Mularien
- 67字
- 2025-04-04 17:54:29
Updating the SQL scripts that are loaded
We need to initialize the DataSource with our custom schema, rather than with Spring Security's default schema. Update the DataSourceConfig.java file, as follows:
//src/main/java/com/packtpub/springsecurity/configuration/DataSourceConfig.java
@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setName("dataSource")
.setType(EmbeddedDatabaseType.H2)
.addScript("/database/h2/calendar-schema.sql")
.addScript("/database/h2/calendar-data.sql")
.addScript("/database/h2/calendar-authorities.sql")
.build();
}
Notice that we have removed all of the scripts that start with security, and replaced them with calendar-authorities.sql.