org.springframework.boot.SpringApplication#setAdditionalProfiles ( )源码实例Demo

下面列出了org.springframework.boot.SpringApplication#setAdditionalProfiles ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-cloud-task   文件: TaskPartitionerTests.java
@Test
public void testWithLocalDeployer() throws Exception {
	SpringApplication app = new SpringApplication(PartitionedBatchJobApplication.class);
	app.setAdditionalProfiles("master");
	Properties properties = new Properties();
	properties.setProperty("spring.datasource.url", DATASOURCE_URL);
	properties.setProperty("spring.datasource.username", DATASOURCE_USER_NAME);
	properties.setProperty("spring.datasource.driverClassName", DATASOURCE_DRIVER_CLASS_NAME);
	properties.setProperty("spring.cloud.deployer.local.use-spring-application-json", "false");
	app.setDefaultProperties(properties);
	app.run();

	Page<TaskExecution> taskExecutions = this.taskExplorer
		.findAll(PageRequest.of(0, 10));
	assertThat(taskExecutions.getTotalElements()).as("Five rows are expected")
		.isEqualTo(5);
	assertThat(this.taskExplorer
		.getTaskExecutionCountByTaskName("PartitionedBatchJobTask"))
		.as("Only One master is expected").isEqualTo(1);
	for (TaskExecution taskExecution : taskExecutions) {
		assertThat(taskExecution.getExitCode()
			.intValue()).as("return code should be 0").isEqualTo(0);
	}
}
 
源代码2 项目: spring-data-dev-tools   文件: MongoDbFixture.java
MongoDbFixture() {

		SpringApplication application = new SpringApplication();
		application.addPrimarySources(Collections.singletonList(MongoDbApplication.class));
		application.setAdditionalProfiles("jpa");
		application.setLazyInitialization(true);

		this.context = application.run();
		
		MongoOperations operations = context.getBean(MongoOperations.class);
		
		operations.dropCollection(Book.class);
		
		IntStream.range(0, Constants.NUMBER_OF_BOOKS) //
			.mapToObj(it -> new Book("title" + it, it)) //
			.forEach(operations::save);
	}
 
/**
 * 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);
    }
}
 
源代码4 项目: jhipster-ribbon-hystrix   文件: GatewayApp.java
/**
 * 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);
    }
}
 
源代码5 项目: jhipster-ribbon-hystrix   文件: BarApp.java
/**
 * 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);
    }
}
 
源代码6 项目: gpmr   文件: GpmrApp.java
/**
 * 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);
    }
}
 
源代码7 项目: para   文件: ParaServer.java
/**
 * This is the initializing method when running ParaServer as executable JAR (or WAR),
 * from the command line: java -jar para.jar.
 * @param args command line arguments array (same as those in {@code void main(String[] args)} )
 * @param sources the application classes that will be scanned
 */
public static void runAsJAR(String[] args, Class<?>... sources) {
	// entry point (JAR)
	SpringApplication app = new SpringApplication(sources);
	app.setAdditionalProfiles(Config.ENVIRONMENT);
	app.setWebApplicationType(WebApplicationType.SERVLET);
	app.setBannerMode(Banner.Mode.OFF);
	if (Config.getConfigBoolean("pidfile_enabled", true)) {
		app.addListeners(new ApplicationPidFileWriter(Config.PARA + "_" + getServerPort() + ".pid"));
	}
	initialize(getCoreModules());
	app.run(args);
}
 
源代码8 项目: ServiceCutter   文件: Application.java
/**
 * 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);
    }
}
 
源代码9 项目: huanhuan-blog   文件: AbstractApplication.java
/**
 * 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);
    }
}
 
源代码10 项目: SCS-ESI   文件: OrderTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码11 项目: microservice   文件: CustomerTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(CustomerTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码12 项目: microservice-consul   文件: CustomerTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(CustomerTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码13 项目: microservice-kubernetes   文件: OrderTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码14 项目: code-examples   文件: ProfilesApplication.java
public static void main(String[] args) {
	SpringApplication application = new SpringApplication(ProfilesApplication.class);
	application.setAdditionalProfiles("baz");
	application.run(args);
}
 
源代码15 项目: microservice-kafka   文件: OrderTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码16 项目: microservice-kafka   文件: ShippingTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(ShippingTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码17 项目: microservice-kafka   文件: InvoiceTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(InvoiceTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码18 项目: microservice-atom   文件: InvoiceTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(InvoiceTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码19 项目: microservice-atom   文件: OrderTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
源代码20 项目: microservice   文件: CatalogTestApp.java
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(CatalogTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}