Java Code Examples for org.springframework.boot.SpringApplication#setAdditionalProfiles()

The following examples show how to use org.springframework.boot.SpringApplication#setAdditionalProfiles() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskPartitionerTests.java    From spring-cloud-task with Apache License 2.0 6 votes vote down vote up
@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);
	}
}
 
Example 2
Source File: MongoDbFixture.java    From spring-data-dev-tools with Apache License 2.0 6 votes vote down vote up
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);
	}
 
Example 3
Source File: GatewayApp.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 4
Source File: BarApp.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 5
Source File: GpmrApp.java    From gpmr with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 6
Source File: ParaServer.java    From para with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: Application.java    From ServiceCutter with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 8
Source File: AbstractApplication.java    From springboot-multiple-dataSources with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 9
Source File: AbstractApplication.java    From huanhuan-blog with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 10
Source File: OrderTestApp.java    From SCS-ESI with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 11
Source File: CustomerTestApp.java    From microservice with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(CustomerTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 12
Source File: CatalogTestApp.java    From microservice with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(CatalogTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 13
Source File: OrderTestApp.java    From microservice-atom with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 14
Source File: InvoiceTestApp.java    From microservice-atom with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(InvoiceTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 15
Source File: InvoiceTestApp.java    From microservice-kafka with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(InvoiceTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 16
Source File: ShippingTestApp.java    From microservice-kafka with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(ShippingTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 17
Source File: OrderTestApp.java    From microservice-kafka with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 18
Source File: ProfilesApplication.java    From code-examples with MIT License 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication application = new SpringApplication(ProfilesApplication.class);
	application.setAdditionalProfiles("baz");
	application.run(args);
}
 
Example 19
Source File: OrderTestApp.java    From microservice-kubernetes with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(OrderTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}
 
Example 20
Source File: CustomerTestApp.java    From microservice-consul with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	SpringApplication app = new SpringApplication(CustomerTestApp.class);
	app.setAdditionalProfiles("test");
	app.run(args);
}