| margaretha | f68daa6 | 2017-09-21 02:11:24 +0200 | [diff] [blame] | 1 | package de.ids_mannheim.korap.config; |
| 2 | |
| 3 | import java.io.IOException; |
| 4 | import java.io.InputStream; |
| 5 | import java.util.Properties; |
| 6 | |
| 7 | import org.springframework.context.annotation.Bean; |
| 8 | import org.springframework.context.annotation.Configuration; |
| 9 | |
| 10 | @Configuration |
| 11 | public class AppTestConfigBase { |
| 12 | |
| 13 | private static String mainConfigurationFile = "kustvakt-test.conf"; |
| 14 | |
| 15 | @Bean(name = ContextHolder.KUSTVAKT_CONFIG) |
| 16 | public KustvaktConfiguration getConfig () { |
| 17 | |
| 18 | KustvaktConfiguration c = null; |
| 19 | |
| 20 | InputStream s = ConfigLoader.loadConfigStream(mainConfigurationFile); |
| 21 | |
| 22 | if (s != null){ |
| 23 | Properties p = new Properties(); |
| 24 | try { |
| 25 | p.load(s); |
| 26 | c = new KustvaktConfiguration(p); |
| 27 | } |
| 28 | catch (IOException e) { |
| 29 | e.printStackTrace(); |
| 30 | } |
| 31 | } |
| 32 | else { |
| 33 | System.out.println("No properties found!"); |
| 34 | System.exit(-1); |
| 35 | } |
| 36 | return c; |
| 37 | } |
| 38 | |
| 39 | } |