I have an application with an application.yml, but I want another configuration file by the name foo.yml. I can't seem to get it to work. What's wrong with my code?
@ConfigurationProperties(prefix = "test")
@Configuration
@PropertySource(value = "classpath:foo.yml")
public class All {
String oof;
// getters and setters and toString
}
My foo.yml
test:
oof: "bloof"
My test, where oof outputs as null instead of bloof
@ExtendWith(SpringExtension.class)
@SpringBootTest
class AllTest {
@Autowired
private All all;
@Test
public void test {
System.out.println(all.toString());
}
}