Skip to content
Snippets Groups Projects
Commit 73422997 authored by Paul-Christian Volkmer's avatar Paul-Christian Volkmer
Browse files

Load example properties as ClassPathResource

parent 725961aa
No related merge requests found
......@@ -3,19 +3,16 @@ package de.thm.arsnova.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import de.thm.arsnova.connector.client.ConnectorClient;
import de.thm.arsnova.connector.client.ConnectorClientImpl;
@Configuration
@PropertySources({
@PropertySource("arsnova.properties.example"),
@PropertySource("file:///etc/arsnova/arsnova.properties"),
})
public class ExtraConfig {
@Autowired
......@@ -24,6 +21,10 @@ public class ExtraConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
configurer.setLocations(new Resource[] {
new ClassPathResource("arsnova.properties.example"),
new FileSystemResource("file:///etc/arsnova/arsnova.properties"),
});
configurer.setIgnoreResourceNotFound(true);
configurer.setIgnoreUnresolvablePlaceholders(false);
return configurer;
......
......@@ -5,7 +5,6 @@ import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
......@@ -23,9 +22,6 @@ import de.thm.arsnova.connector.client.ConnectorClient;
})
public class ExtraConfigTest {
@Autowired
PropertySourcesPlaceholderConfigurer configurer;
@Autowired(required = false)
private ConnectorClient connectorClient;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment