我有一个春季启动应用程序.
我的应用程序中有三个配置文件 - > 开发,登台和生产.所以我有3个文件
我的application.yml驻留在里面src/main/resources.我已将application.yml中的活动配置文件设置为:
spring:
profiles.active: development
Run Code Online (Sandbox Code Playgroud)
其他3个配置文件特定的配置文件存在于C:\config文件夹中.
我正在使用gradle插件进行eclipse.当我尝试执行" bootRun "时,我在eclipse中的gradle配置中设置命令行参数
-Dspring.profiles.active=staging -Dspring.config.location=C:\Config
Run Code Online (Sandbox Code Playgroud)
但是,命令行属性没有得到反映,我的活动配置文件总是被设置为开发(这是我在applications.yml文件中提到的那个).此外,不会在C:\ Config文件夹中搜索特定于配置文件的配置文件.
我想我在这里遗漏了一些东西.过去两天我一直试图解决这个问题.但没有运气.我真的很感激任何帮助.
我试图理解Java 8中的CompletableFuture.作为其中的一部分,我正在尝试进行一些REST调用以巩固我的理解.我正在使用这个库来进行REST调用:https://github.com/AsyncHttpClient/async-http-client.
请注意,此库返回GET调用的Response对象.
以下是我要做的事情:
构建UserPost对象的集合,每个对象都有一个用户对象和用户发布的帖子列表.
public class UserPosts {
private final User user;
private final List<Post> posts;
public UserPosts(User user, List<Post> posts) {
this.user = user;
this.posts = posts;
}
@Override
public String toString() {
return "user = " + this.user + " \n" + "post = " + posts+ " \n \n";
}
Run Code Online (Sandbox Code Playgroud)
}
我目前实现如下:
package com.CompletableFuture;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture; …Run Code Online (Sandbox Code Playgroud)