32 lines
1013 B
Java
32 lines
1013 B
Java
package org.lucares.pdbui;
|
|
|
|
import java.io.IOException;
|
|
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;
|
|
|
|
@Configuration
|
|
@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) throws IOException {
|
|
final Path dataDirectory = Paths.get(dbBaseDir);
|
|
|
|
LOGGER.info("using database in {}", dataDirectory.toAbsolutePath());
|
|
|
|
return new PerformanceDb(dataDirectory);
|
|
}
|
|
}
|