2-7节配javaPropertyValue 值怎么设置为Mercy的,视频中怎么没看到,我本地的javaPropertyValue值默认是null

来源:2-9 基于编程方式实现条件装配

慕码人232225

2018-09-06

public class OnSystemPropertyCondition implements Condition {

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

        Map<String, Object> attributes = metadata.
                getAnnotationAttributes(ConditionalOnSystemProperty.class.getName());

        String propertyName = String.valueOf(attributes.get("name"));
        String propertyValue = String.valueOf(attributes.get("value"));

        String javaPropertyValue = System.getProperty(propertyName);

        return propertyValue.equals(javaPropertyValue);
    }
}

这里的javaPropertyValue 值怎么设置为Mercy的,视频中怎么没看到,我本地的javaPropertyValue值默认是null

写回答

3回答

此间道

2020-03-18

这些都是自己环境的系统变量,可以把 System.getProperties()的返回值遍历,看看都有哪些系统设置

0
0

黑车轴

2018-12-20

如题,,我也遇到了同样的问题!

0
0

泡沫鱼

2018-09-17

系统变量, 你设置一下就好了

0
1
黑车轴
请问要如何配置呢?
2018-12-20
共1条回复

Spring Boot2.0深度实践 核心原理拆解+源码分析

系统化剖析Spring Boot 2.0,掌握技术原理,学习源码阅读技巧

2904 学习 · 213 问题

查看课程