July 2018
Intermediate to advanced
268 pages
7h 36m
English
Create a Java class named ApplicationConfig with the following code in the com.packtpub.book.ch02.springsecurity.config package:
@Configuration@PropertySource("classpath:mysqldb.properties")public class ApplicationConfig { @Autowired private Environment env; @Bean public DataSource getDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(env.getProperty("mysql.driver")); dataSource.setUrl(env.getProperty("mysql.jdbcUrl")); dataSource.setUsername(env.getProperty("mysql.username")); dataSource.setPassword(env.getProperty("mysql.password")); return dataSource; }}
Read now
Unlock full access