Hi I am using Spring Boot, I want to inject the values of the .yml file in the Bean. I have written the integration test case but looks like via Integration test case it not
Here's another way: [Spring Boot v1.4.x]
import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@BootstrapWith(SpringBootTestContextBootstrapper.class)
public class CassandraClientTest {
@Autowired
private TestBean bean;
@Test
public void test() {
bean.print();
}
}
This works ONLY if also 'application.properties' file exists.
e.g. maven project:
src/main/resources/application.properties [ The file can be empty but it's mandatory! ]
src/main/resources/application.yml [here's your real config file]