當前位置: 首頁>>代碼示例>>Java>>正文


Java SpringApplication.setAdditionalProfiles方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:heikehuan,項目名稱:fly4j,代碼行數:11,代碼來源:AbstractApplication.java

示例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);
    }
}
 
開發者ID:GastonMauroDiaz,項目名稱:buenojo,代碼行數:11,代碼來源:Application.java

示例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
}
 
開發者ID:openmicroscopy,項目名稱:omero-ms-queue,代碼行數:8,代碼來源:ImportServer.java

示例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);
}
 
開發者ID:Erudika,項目名稱:scoold,代碼行數:9,代碼來源:ScooldServer.java

示例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);
}
 
開發者ID:ewolff,項目名稱:microservice-cloudfoundry,代碼行數:6,代碼來源:CatalogTestApp.java

示例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);
}
 
開發者ID:ewolff,項目名稱:microservice-cloudfoundry,代碼行數:6,代碼來源:CustomerTestApp.java

示例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);
}
 
開發者ID:ewolff,項目名稱:microservice-cloudfoundry,代碼行數:6,代碼來源:OrderTestApp.java

示例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);
}
 
開發者ID:namics,項目名稱:spring-configuration-support,代碼行數:6,代碼來源:Application.java

示例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);
}
 
開發者ID:namics,項目名稱:spring-configuration-support,代碼行數:6,代碼來源:SampleApplication.java

示例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);
                }
            }
        }
    }
 
開發者ID:remipassmoilesel,項目名稱:simple-hostel-management,代碼行數:69,代碼來源:Application.java

示例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);
}
 
開發者ID:ewolff,項目名稱:microservice-kafka,代碼行數:6,代碼來源:ShippingTestApp.java

示例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);
}
 
開發者ID:ewolff,項目名稱:microservice-kafka,代碼行數:6,代碼來源:InvoiceTestApp.java


注:本文中的org.springframework.boot.SpringApplication.setAdditionalProfiles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。