@PropertySource注解加载指定的属性文件
package com.myproject;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
@EnableEurekaServer
//File协议主要用于访问本地计算机中的文件,就如同在Windows资源管理器中打开文件一样。
@PropertySource(value = "file:${user.dir}/Config/application.properties")
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
package org.springframework.context.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
imp