replace PdbRepository with @Bean annotated method
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
package org.lucares.pdbui;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.lucares.performance.db.PerformanceDb;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
@@ -9,4 +17,14 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
@ComponentScan("org.lucares.pdbui")
|
||||
public class MySpringConfiguration {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MySpringConfiguration.class);
|
||||
|
||||
@Bean
|
||||
PerformanceDb performanceDb(@Value("${db.base}") final String dbBaseDir) {
|
||||
final Path dataDirectory = Paths.get(dbBaseDir);
|
||||
|
||||
LOGGER.info("using database in {}", dataDirectory.toAbsolutePath());
|
||||
|
||||
return new PerformanceDb(dataDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user