本文整理汇总了Java中org.springframework.boot.SpringApplication.setDefaultProperties方法的典型用法代码示例。如果您正苦于以下问题:Java SpringApplication.setDefaultProperties方法的具体用法?Java SpringApplication.setDefaultProperties怎么用?Java SpringApplication.setDefaultProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.SpringApplication
的用法示例。
在下文中一共展示了SpringApplication.setDefaultProperties方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setBannerMode(Banner.Mode.OFF);
app.setLogStartupInfo(false);
app.setRegisterShutdownHook(false);
Map<String, Object> pro = Maps.newHashMap();
pro.put("logging.level.root", "ERROR");
app.setDefaultProperties(pro);
app.run(args);
}
示例2: addDefaultProfile
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
/**
* Set a default to use when no profile is configured.
*
* @param app the Spring application
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
/*
* The default profile to use when no other profiles are defined
* This cannot be set in the <code>application.yml</code> file.
* See https://github.com/spring-projects/spring-boot/issues/1219
*/
defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
app.setDefaultProperties(defProperties);
}
示例3: main
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
//更改properties配置文件名称,避免依赖冲突
Properties properties = new Properties();
InputStream in = AdminApplication.class.getClassLoader().getResourceAsStream("admin.properties");
properties.load(in);
SpringApplication app = new SpringApplication(AdminApplication.class);
app.setDefaultProperties(properties);
app.run(args);
// SpringApplication.run(CommonApplication.class, args);
}
示例4: addDefaultProfile
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
/**
* Set a default to use when no profile is configured.
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
/*
* The default profile to use when no other profiles are defined
* This cannot be set in the <code>application.yml</code> file.
* See https://github.com/spring-projects/spring-boot/issues/1219
*/
defProperties.put(SPRING_PROFILE_ACTIVE, getDefaultActiveProfiles());
app.setDefaultProperties(defProperties);
}
示例5: main
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
//更改properties配置文件名称,避免依赖冲突
Properties properties = new Properties();
InputStream in = PortalApplication.class.getClassLoader().getResourceAsStream("portal.properties");
properties.load(in);
SpringApplication app = new SpringApplication(PortalApplication.class);
app.setDefaultProperties(properties);
app.run(args);
}
示例6: addDefaultProfile
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
/**
* Set a default to use when no profile is configured.
*
* @param app the Spring application
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
/*
* The default profile to use when no other profiles are defined
* This cannot be set in the <code>application.yml</code> file.
* See https://github.com/spring-projects/spring-boot/issues/1219
*/
defProperties.put(SPRING_PROFILE_DEFAULT, Constants.SPRING_PROFILE_DEVELOPMENT);
app.setDefaultProperties(defProperties);
}
示例7: addDefaultProfile
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
/**
* Set a default to use when no profile is configured.
*
* @param app the Spring application
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
/*
* The default profile to use when no other profiles are defined
* This cannot be set in the <code>application.yml</code> file.
* See https://github.com/spring-projects/spring-boot/issues/1219
*/
defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
app.setDefaultProperties(defProperties);
}
示例8: startApplication
import org.springframework.boot.SpringApplication; //导入方法依赖的package包/类
private static void startApplication(String[] args) {
SpringApplication app = new SpringApplication(Akir.class);
app.setDefaultProperties(getDefaultProperties());
app.run(args);
}