测试类:
import com.spx.App;
import com.spx.config.MyProperties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = App.class)
public class MyPropertiesTest {
@Autowired
private MyProperties properties;
@Test
public void test(){
System.out.println(properties.getArray());
System.out.println(properties.getList());
System.out.println(properties.getMap());
System.out.println(properties.getListMap());
}
}