为什么@Value(" $ {user}")始终是我的计算机用户名

时间:2018-02-08 03:24:35

标签: spring-boot spring-el

@SpringBootApplication
@RestController
public class TestNameApplication {

    @Value("${user.name}")
    public String name;

    @RequestMapping("/hello")
    public String hello() {
        return name;
    }

    public static void main(String[] args) {
        SpringApplication.run(TestNameApplication.class, args);
    }
}

这是一个非常简单的演示来简化问题。 首先,application.properties

中没有任何内容

但每次启动此应用程序时,Name始终是我的计算机用户名。是否在application.properties中覆盖此属性。

我不知道是否由于spring-el的默认属性。

3 个答案:

答案 0 :(得分:1)

因为它是系统属性(user.name)。 Boot也会看到环境变量,并应用大小写转换......

$ env | grep USER

您有属性名称冲突。 user也无法工作。

系统属性和环境变量优先于应用程序属性documentation here

使用unqique属性名称,例如myapp.user.name

答案 1 :(得分:1)

user.name将返回您计算机的用户名

看看这个:

不仅user.name

但也包括下面的所有内容

{
    "java.runtime.name": "Java(TM) SE Runtime Environment",
    "sun.boot.library.path": "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib",
    "java.vm.version": "25.101-b13",
    "gopherProxySet": "false",
    "java.vm.vendor": "Oracle Corporation",
    "java.vendor.url": "http://java.oracle.com/",
    "path.separator": ":",
    "java.vm.name": "Java HotSpot(TM) 64-Bit Server VM",
    "file.encoding.pkg": "sun.io",
    "user.country": "CN",
    "sun.java.launcher": "SUN_STANDARD",
    "sun.os.patch.level": "unknown",
    "java.vm.specification.name": "Java Virtual Machine Specification",
    "user.dir": "/Users/proD/IdeaProjects/microservice/microservice-discovery-eureka",
    "java.runtime.version": "1.8.0_101-b13",
    "java.awt.graphicsenv": "sun.awt.CGraphicsEnvironment",
    "java.endorsed.dirs": "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/endorsed",
    "os.arch": "x86_64",
    "java.io.tmpdir": "/var/folders/yr/vf1tr7v14l7gck8d__jf03fh0000gn/T/",
    "line.separator": "\n",
    "java.vm.specification.vendor": "Oracle Corporation",
    "os.name": "Mac OS X",
    "sun.jnu.encoding": "UTF-8",
    "java.library.path": "/Users/proD/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.",
    "java.specification.name": "Java Platform API Specification",
    "java.class.version": "52.0",
    "sun.management.compiler": "HotSpot 64-Bit Tiered Compilers",
    "os.version": "10.13.6",
    "user.home": "/Users/proD",
    "user.timezone": "Asia/Shanghai",
    "java.awt.printerjob": "sun.lwawt.macosx.CPrinterJob",
    "file.encoding": "UTF-8",
    "java.specification.version": "1.8",
    "java.class.path": "/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/lib/tools.jar:/Users/proD/IdeaProjects/microservice/microservice-discovery-eureka/target/test-classes:/Users/proD/IdeaProjects/microservice/microservice-discovery-eureka/target/classes:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-starter-eureka-server/1.2.3.RELEASE/spring-cloud-starter-eureka-server-1.2.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-starter/1.1.6.RELEASE/spring-cloud-starter-1.1.6.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-context/1.1.6.RELEASE/spring-cloud-context-1.1.6.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/security/spring-security-crypto/4.1.4.RELEASE/spring-security-crypto-4.1.4.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-commons/1.1.6.RELEASE/spring-cloud-commons-1.1.6.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/security/spring-security-rsa/1.0.3.RELEASE/spring-security-rsa-1.0.3.RELEASE.jar:/Users/proD/.m2/repository/org/bouncycastle/bcpkix-jdk15on/1.55/bcpkix-jdk15on-1.55.jar:/Users/proD/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.55/bcprov-jdk15on-1.55.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-netflix-eureka-server/1.2.3.RELEASE/spring-cloud-netflix-eureka-server-1.2.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.4.3.RELEASE/spring-boot-starter-web-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.4.3.RELEASE/spring-boot-starter-tomcat-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.6/tomcat-embed-core-8.5.6.jar:/Users/proD/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.6/tomcat-embed-el-8.5.6.jar:/Users/proD/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.6/tomcat-embed-websocket-8.5.6.jar:/Users/proD/.m2/repository/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar:/Users/proD/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/Users/proD/.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar:/Users/proD/.m2/repository/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar:/Users/proD/.m2/repository/org/springframework/spring-webmvc/4.3.5.RELEASE/spring-webmvc-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/1.4.3.RELEASE/spring-boot-starter-actuator-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-actuator/1.4.3.RELEASE/spring-boot-actuator-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-freemarker/1.4.3.RELEASE/spring-boot-starter-freemarker-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/freemarker/freemarker/2.3.25-incubating/freemarker-2.3.25-incubating.jar:/Users/proD/.m2/repository/org/springframework/spring-context-support/4.3.5.RELEASE/spring-context-support-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-netflix-core/1.2.3.RELEASE/spring-cloud-netflix-core-1.2.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-netflix-eureka-client/1.2.3.RELEASE/spring-cloud-netflix-eureka-client-1.2.3.RELEASE.jar:/Users/proD/.m2/repository/com/netflix/eureka/eureka-client/1.4.12/eureka-client-1.4.12.jar:/Users/proD/.m2/repository/org/codehaus/jettison/jettison/1.3.7/jettison-1.3.7.jar:/Users/proD/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/Users/proD/.m2/repository/com/netflix/netflix-commons/netflix-eventbus/0.3.0/netflix-eventbus-0.3.0.jar:/Users/proD/.m2/repository/com/netflix/netflix-commons/netflix-infix/0.3.0/netflix-infix-0.3.0.jar:/Users/proD/.m2/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar:/Users/proD/.m2/repository/joda-time/joda-time/2.9.6/joda-time-2.9.6.jar:/Users/proD/.m2/repository/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar:/Users/proD/.m2/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar:/Users/proD/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/Users/proD/.m2/repository/com/google/code/gson/gson/2.7/gson-2.7.jar:/Users/proD/.m2/repository/org/apache/commons/commons-math/2.2/commons-math-2.2.jar:/Users/proD/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar:/Users/proD/.m2/repository/com/netflix/servo/servo-core/0.10.1/servo-core-0.10.1.jar:/Users/proD/.m2/repository/com/netflix/servo/servo-internal/0.10.1/servo-internal-0.10.1.jar:/Users/proD/.m2/repository/com/sun/jersey/jersey-core/1.19.1/jersey-core-1.19.1.jar:/Users/proD/.m2/repository/com/sun/jersey/jersey-client/1.19.1/jersey-client-1.19.1.jar:/Users/proD/.m2/repository/com/sun/jersey/contribs/jersey-apache-client4/1.19.1/jersey-apache-client4-1.19.1.jar:/Users/proD/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar:/Users/proD/.m2/repository/org/apache/httpcomponents/httpcore/4.4.5/httpcore-4.4.5.jar:/Users/proD/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:/Users/proD/.m2/repository/com/google/inject/guice/4.0/guice-4.0.jar:/Users/proD/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/proD/.m2/repository/com/netflix/governator/governator-api/1.12.10/governator-api-1.12.10.jar:/Users/proD/.m2/repository/com/sun/jersey/jersey-servlet/1.19.1/jersey-servlet-1.19.1.jar:/Users/proD/.m2/repository/com/sun/jersey/jersey-server/1.19.1/jersey-server-1.19.1.jar:/Users/proD/.m2/repository/com/netflix/eureka/eureka-core/1.4.12/eureka-core-1.4.12.jar:/Users/proD/.m2/repository/com/netflix/governator/governator/1.12.10/governator-1.12.10.jar:/Users/proD/.m2/repository/com/netflix/governator/governator-core/1.12.10/governator-core-1.12.10.jar:/Users/proD/.m2/repository/com/google/inject/extensions/guice-multibindings/4.0/guice-multibindings-4.0.jar:/Users/proD/.m2/repository/com/google/inject/extensions/guice-grapher/4.0/guice-grapher-4.0.jar:/Users/proD/.m2/repository/com/google/inject/extensions/guice-assistedinject/4.0/guice-assistedinject-4.0.jar:/Users/proD/.m2/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar:/Users/proD/.m2/repository/org/codehaus/woodstox/woodstox-core-asl/4.4.1/woodstox-core-asl-4.4.1.jar:/Users/proD/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/Users/proD/.m2/repository/com/netflix/archaius/archaius-core/0.7.4/archaius-core-0.7.4.jar:/Users/proD/.m2/repository/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar:/Users/proD/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/Users/proD/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.8.5/jackson-dataformat-xml-2.8.5.jar:/Users/proD/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.8.5/jackson-module-jaxb-annotations-2.8.5.jar:/Users/proD/.m2/repository/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar:/Users/proD/.m2/repository/com/fasterxml/woodstox/woodstox-core/5.0.3/woodstox-core-5.0.3.jar:/Users/proD/.m2/repository/com/thoughtworks/xstream/xstream/1.4.9/xstream-1.4.9.jar:/Users/proD/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar:/Users/proD/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-starter-archaius/1.2.3.RELEASE/spring-cloud-starter-archaius-1.2.3.RELEASE.jar:/Users/proD/.m2/repository/commons-configuration/commons-configuration/1.8/commons-configuration-1.8.jar:/Users/proD/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/Users/proD/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.5/jackson-annotations-2.8.5.jar:/Users/proD/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.5/jackson-core-2.8.5.jar:/Users/proD/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.5/jackson-databind-2.8.5.jar:/Users/proD/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/Users/proD/.m2/repository/org/springframework/cloud/spring-cloud-starter-ribbon/1.2.3.RELEASE/spring-cloud-starter-ribbon-1.2.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.4.3.RELEASE/spring-boot-starter-aop-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar:/Users/proD/.m2/repository/org/springframework/retry/spring-retry/1.1.5.RELEASE/spring-retry-1.1.5.RELEASE.jar:/Users/proD/.m2/repository/com/netflix/ribbon/ribbon/2.2.0/ribbon-2.2.0.jar:/Users/proD/.m2/repository/com/netflix/ribbon/ribbon-transport/2.2.0/ribbon-transport-2.2.0.jar:/Users/proD/.m2/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar:/Users/proD/.m2/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar:/Users/proD/.m2/repository/com/netflix/hystrix/hystrix-core/1.5.6/hystrix-core-1.5.6.jar:/Users/proD/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/proD/.m2/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar:/Users/proD/.m2/repository/io/netty/netty-codec-http/4.0.27.Final/netty-codec-http-4.0.27.Final.jar:/Users/proD/.m2/repository/io/netty/netty-codec/4.0.27.Final/netty-codec-4.0.27.Final.jar:/Users/proD/.m2/repository/io/netty/netty-handler/4.0.27.Final/netty-handler-4.0.27.Final.jar:/Users/proD/.m2/repository/io/netty/netty-transport-native-epoll/4.0.27.Final/netty-transport-native-epoll-4.0.27.Final.jar:/Users/proD/.m2/repository/io/netty/netty-common/4.0.27.Final/netty-common-4.0.27.Final.jar:/Users/proD/.m2/repository/io/netty/netty-buffer/4.0.27.Final/netty-buffer-4.0.27.Final.jar:/Users/proD/.m2/repository/io/netty/netty-transport/4.0.27.Final/netty-transport-4.0.27.Final.jar:/Users/proD/.m2/repository/com/netflix/ribbon/ribbon-core/2.2.0/ribbon-core-2.2.0.jar:/Users/proD/.m2/repository/com/netflix/ribbon/ribbon-httpclient/2.2.0/ribbon-httpclient-2.2.0.jar:/Users/proD/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/proD/.m2/repository/com/netflix/netflix-commons/netflix-commons-util/0.1.1/netflix-commons-util-0.1.1.jar:/Users/proD/.m2/repository/com/netflix/ribbon/ribbon-loadbalancer/2.2.0/ribbon-loadbalancer-2.2.0.jar:/Users/proD/.m2/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar:/Users/proD/.m2/repository/io/reactivex/rxjava/1.1.10/rxjava-1.1.10.jar:/Users/proD/.m2/repository/com/netflix/ribbon/ribbon-eureka/2.2.0/ribbon-eureka-2.2.0.jar:/Users/proD/.m2/repository/org/slf4j/slf4j-api/1.7.22/slf4j-api-1.7.22.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-test/1.4.3.RELEASE/spring-boot-starter-test-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-test/1.4.3.RELEASE/spring-boot-test-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot/1.4.3.RELEASE/spring-boot-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-test-autoconfigure/1.4.3.RELEASE/spring-boot-test-autoconfigure-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.4.3.RELEASE/spring-boot-autoconfigure-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/com/jayway/jsonpath/json-path/2.2.0/json-path-2.2.0.jar:/Users/proD/.m2/repository/net/minidev/json-smart/2.2.1/json-smart-2.2.1.jar:/Users/proD/.m2/repository/net/minidev/accessors-smart/1.1/accessors-smart-1.1.jar:/Users/proD/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/proD/.m2/repository/org/assertj/assertj-core/2.5.0/assertj-core-2.5.0.jar:/Users/proD/.m2/repository/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar:/Users/proD/.m2/repository/org/objenesis/objenesis/2.1/objenesis-2.1.jar:/Users/proD/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/proD/.m2/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar:/Users/proD/.m2/repository/org/skyscreamer/jsonassert/1.3.0/jsonassert-1.3.0.jar:/Users/proD/.m2/repository/org/json/json/20140107/json-20140107.jar:/Users/proD/.m2/repository/org/springframework/spring-core/4.3.5.RELEASE/spring-core-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/spring-test/4.3.5.RELEASE/spring-test-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-security/1.4.3.RELEASE/spring-boot-starter-security-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter/1.4.3.RELEASE/spring-boot-starter-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.4.3.RELEASE/spring-boot-starter-logging-1.4.3.RELEASE.jar:/Users/proD/.m2/repository/ch/qos/logback/logback-classic/1.1.8/logback-classic-1.1.8.jar:/Users/proD/.m2/repository/ch/qos/logback/logback-core/1.1.8/logback-core-1.1.8.jar:/Users/proD/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.22/jcl-over-slf4j-1.7.22.jar:/Users/proD/.m2/repository/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar:/Users/proD/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.22/log4j-over-slf4j-1.7.22.jar:/Users/proD/.m2/repository/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar:/Users/proD/.m2/repository/org/springframework/spring-aop/4.3.5.RELEASE/spring-aop-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/spring-beans/4.3.5.RELEASE/spring-beans-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/security/spring-security-config/4.1.4.RELEASE/spring-security-config-4.1.4.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/security/spring-security-core/4.1.4.RELEASE/spring-security-core-4.1.4.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/spring-context/4.3.5.RELEASE/spring-context-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/security/spring-security-web/4.1.4.RELEASE/spring-security-web-4.1.4.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/spring-expression/4.3.5.RELEASE/spring-expression-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/org/springframework/spring-web/4.3.5.RELEASE/spring-web-4.3.5.RELEASE.jar:/Users/proD/.m2/repository/com/alibaba/fastjson/1.2.46/fastjson-1.2.46.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar",
    "user.name": "proD",
    "java.vm.specification.version": "1.8",
    "sun.java.command": "com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 org.proD.cloud.microservicediscoveryeureka.MicroserviceDiscoveryEurekaApplicationTests,contextLoads",
    "java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre",
    "sun.arch.data.model": "64",
    "user.language": "zh",
    "java.specification.vendor": "Oracle Corporation",
    "user.language.format": "en",
    "awt.toolkit": "sun.lwawt.macosx.LWCToolkit",
    "java.vm.info": "mixed mode",
    "java.version": "1.8.0_101",
    "java.ext.dirs": "/Users/proD/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java",
    "sun.boot.class.path": "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/classes",
    "java.vendor": "Oracle Corporation",
    "file.separator": "/",
    "java.vendor.url.bug": "http://bugreport.sun.com/bugreport/",
    "idea.test.cyclic.buffer.size": "1048576",
    "sun.io.unicode.encoding": "UnicodeBig",
    "sun.cpu.endian": "little",
    "sun.cpu.isalist": ""
}

答案 2 :(得分:0)

你是对的!这是标准的Java系统属性。见the Oracle docs about it

  

" user.name"用户帐户名称