EmbeddedWebApplicationContextTests.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:https-github.com-g0t4-jenkins2-course-spring-boot 作者:
@Test
public void postProcessEmbeddedServletContainerFactory() throws Exception {
    RootBeanDefinition bd = new RootBeanDefinition(
            MockEmbeddedServletContainerFactory.class);
    MutablePropertyValues pv = new MutablePropertyValues();
    pv.add("port", "${port}");
    bd.setPropertyValues(pv);
    this.context.registerBeanDefinition("embeddedServletContainerFactory", bd);

    PropertySourcesPlaceholderConfigurer propertySupport = new PropertySourcesPlaceholderConfigurer();
    Properties properties = new Properties();
    properties.put("port", 8080);
    propertySupport.setProperties(properties);
    this.context.registerBeanDefinition("propertySupport",
            beanDefinition(propertySupport));

    this.context.refresh();
    assertThat(getEmbeddedServletContainerFactory().getContainer().getPort())
            .isEqualTo(8080);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号