本文整理匯總了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);
}