Java 类org.springframework.boot.actuate.autoconfigure.ManagementServerProperties 实例源码

项目:Zipkin    文件:TraceWebAutoConfiguration.java   
@Bean
@ConditionalOnBean(ManagementServerProperties.class)
public SkipPatternProvider skipPatternForManagementServerProperties(
        final ManagementServerProperties managementServerProperties) {
    return new SkipPatternProvider() {
        @Override
        public Pattern skipPattern() {
            return getPatternForManagementServerProperties(
                    managementServerProperties, SkipPatternProviderConfig.this.skipPattern);
        }
    };
}
项目:Zipkin    文件:TraceWebAutoConfiguration.java   
/**
 * Sets or appends {@link ManagementServerProperties#getContextPath()} to the
 * skip pattern. If neither is available then sets the default one
 */
static Pattern getPatternForManagementServerProperties(
        ManagementServerProperties managementServerProperties, String skipPattern) {
    if (StringUtils.hasText(skipPattern) &&
            StringUtils.hasText(managementServerProperties.getContextPath())) {
        return Pattern.compile(skipPattern + "|" +
                managementServerProperties.getContextPath() + ".*");
    } else if (StringUtils.hasText(managementServerProperties.getContextPath())) {
        return Pattern.compile(managementServerProperties.getContextPath() + ".*");
    }
    return defaultSkipPattern(skipPattern);
}
项目:Zipkin    文件:SkipPatternProviderConfigTest.java   
@Test
public void should_pick_skip_pattern_when_its_not_empty_and_management_context_is_empty() throws Exception {
    String skipPattern = "foo.*|bar.*";

    Pattern pattern = SkipPatternProviderConfig.getPatternForManagementServerProperties(new ManagementServerProperties(), skipPattern);

    then(pattern.pattern()).isEqualTo("foo.*|bar.*");
}
项目:Zipkin    文件:SkipPatternProviderConfigTest.java   
@Test
public void should_pick_default_pattern_when_both_management_context_and_skip_patterns_are_empty() throws Exception {
    String skipPattern = "";

    Pattern pattern = SkipPatternProviderConfig.getPatternForManagementServerProperties(new ManagementServerProperties(), skipPattern);

    then(pattern.pattern()).isEqualTo(TraceFilter.DEFAULT_SKIP_PATTERN);
}
项目:onetwo    文件:ActuatorContextConfig.java   
/***
 * 修改actuator的默认contextPath
 */
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    if(bean instanceof ManagementServerProperties){
        /*ManagementServerProperties props = (ManagementServerProperties) bean;
        if(StringUtils.isBlank(props.getContextPath())){
            props.setContextPath(BootWebUtils.CONTROLLER_PREFIX+"/management");
        }*/
        /*if(props.getAddress()==null){
            props.setAddress(NetUtils.getInetAddress("127.0.0.1", null));
        }*/
    }
    return bean;
}
项目:Zipkin    文件:TraceWebAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(ManagementServerProperties.class)
public SkipPatternProvider defaultSkipPatternBeanIfManagementServerPropsArePresent() {
    return defaultSkipPatternProvider(this.skipPattern);
}
项目:Zipkin    文件:SkipPatternProviderConfigTest.java   
private ManagementServerProperties managementServerPropertiesWithContextPath() {
    ManagementServerProperties managementServerProperties = new ManagementServerProperties();
    managementServerProperties.setContextPath("/management/context");
    return managementServerProperties;
}