本文整理匯總了Java中org.springframework.boot.SpringApplication.setAdditionalProfiles方法的典型用法代碼示例。如果您正苦於以下問題:Java SpringApplication.setAdditionalProfiles方法的具體用法?Java SpringApplication.setAdditionalProfiles怎麽用?Java SpringApplication.setAdditionalProfiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.boot.SpringApplication
的用法示例。
在下文中一共展示了SpringApplication.setAdditionalProfiles方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addDefaultProfile
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
/**
* If no profile has been configured, set by default the "dev" profile.
*/
protected static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
if ((System.getProperty("spring.profiles.active") == null)
&& !source.containsProperty("spring.profiles.active")
&& !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
}
}
示例2: addDefaultProfile
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
/**
* If no profile has been configured, set by default the "dev" profile.
*/
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
if (!source.containsProperty("spring.profiles.active") &&
!System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
}
}
示例3: run
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
@Override
public void run(List<String> appArgs) {
SpringApplication app = new SpringApplication(Main.class);
app.setAdditionalProfiles(getProfiles(appArgs));
app.run(); // could pass in appArgs if needed
}
示例4: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
((ch.qos.logback.classic.Logger) logger).setLevel(ch.qos.logback.classic.Level.TRACE);
SpringApplication app = new SpringApplication(new Object[]{ScooldServer.class});
initConfig();
app.setAdditionalProfiles(Config.ENVIRONMENT);
app.setWebEnvironment(true);
app.run(args);
}
示例5: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
SpringApplication app = new SpringApplication(CatalogTestApp.class);
app.setAdditionalProfiles("test");
app.run(args);
}
示例6: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
SpringApplication app = new SpringApplication(CustomerTestApp.class);
app.setAdditionalProfiles("test");
app.run(args);
}
示例7: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
SpringApplication app = new SpringApplication(OrderTestApp.class);
app.setAdditionalProfiles("test");
app.run(args);
}
示例8: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setAdditionalProfiles("DEV");
app.run(args);
}
示例9: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(SampleApplication.class);
springApplication.setAdditionalProfiles("DEV");
springApplication.run(args);
}
示例10: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
// standalone server for development
mainApp = new SpringApplication(Application.class);
// ask for updates
ThreadManager.runLater(() -> {
askForUpdate();
});
logger.warn("Specified arguments: " + Arrays.asList(args));
if (Arrays.asList(args).contains(SpringConfiguration.DEV_PROFILE)) {
mainApp.setAdditionalProfiles(SpringConfiguration.DEV_PROFILE);
}
// listen application to update files
UpdateFilesListener updater = new UpdateFilesListener();
updater.addPeer(Paths.get("src/main/resources"), Paths.get("target/classes"));
// first file update
mainApp.addListeners(updater);
// open browser on launch if needed
mainApp.addListeners((event) -> {
if (event instanceof ApplicationReadyEvent) {
SpringConfiguration config = ((ApplicationReadyEvent) event).getApplicationContext().getBean(SpringConfiguration.class);
if (config == null) {
logger.error("Configuration not ready");
return;
}
if (config.isLaunchBrowserOnStart() == true) {
showMainPage();
}
}
});
// run server
try {
mainApp.run(args);
} catch (Exception e) {
logger.error("Error while launching application: ", e);
// if not headless, show a dialog
if (GraphicsEnvironment.isHeadless() == false) {
String message = "<html><p>Unable to launch application: ";
if (e.getMessage() != null && e.getMessage().length() > 50) {
message += e.getMessage().substring(0, 50) + " ...";
} else {
message += e.getMessage();
}
message += "</p>";
message += "<p>First of all, check if software is not already launched (you will see an icon in your task bar)</p>";
message += "<p>Then try restarting the program. If this error persists, try restarting your computer and restart the program.</p></html>";
try {
JOptionPane.showMessageDialog(null,
message,
"Error",
JOptionPane.ERROR_MESSAGE);
} catch (Exception e2) {
logger.error("Unable to show graphical error: ", e2);
}
}
}
}
示例11: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
SpringApplication app = new SpringApplication(ShippingTestApp.class);
app.setAdditionalProfiles("test");
app.run(args);
}
示例12: main
import org.springframework.boot.SpringApplication; //導入方法依賴的package包/類
public static void main(String[] args) {
SpringApplication app = new SpringApplication(InvoiceTestApp.class);
app.setAdditionalProfiles("test");
app.run(args);
}