java获取application.properties文件的变量值

package com.alibaba.surge.hsf.provider;

import com.alibaba.boot.hsf.annotation.HSFProvider;
import com.alibaba.surge.hsf.EnvService;
import org.springframework.beans.factory.annotation.Value;

/**
 * @author zhenyuan.he
 */
@HSFProvider(serviceInterface = EnvService.class)
public class EnvServiceImpl implements EnvService {

    @Value("${spring.profiles.active}")
    private String currentEnv;

    @Override
    public String getCurrentEnv() {
        return currentEnv;
    }
}

你可能感兴趣的:(spring,boot)