maven错误,因为无法激活所请求的配置文件“ dev”,因为它不存在,但我在application.properties文件中提到了spring.profiles.active = dev
尝试在Eclipse中使用Maven构建spring-boot项目,但存在以下错误: “所请求的配置文件“ dev”不存在,因此无法激活。”
在Eclipse中,maven构建时将参数作为目标传递:清洁编译安装,配置文件:dev 我在application.properties文件中提到了“ spring.profiles.active = dev”。 application.properties:
spring.profiles.active=dev,postgres
logging.level.org.springframework.security.oauth2=debug
班级:
import org.springframework.context.annotation.Profile;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Profile("dev")
public @interface Dev {
}
控制台日志:
[INFO] Scanning for projects...
[INFO]
-
-
-
[INFO] Building company-structure-spring-security-oauth2-authorities 1.0-SNAPSHOT
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.258 s
[INFO] Finished at: 2019-08-08T11:27:14+05:30
[INFO] Final Memory: 29M/69M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "dev" could not be activated because it does not exist.