Skip to content

Support .env file for configuration properties #24229

@linux-china

Description

@linux-china

Lots of developers use .env to process own configuration for script or app. Now I add spring.config.import in application.properties as following:

spring.config.import=optional:file:.env

and SpringBoot app throws the following exception:

Caused by: java.lang.IllegalStateException: File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/'
	at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferencesForFile(StandardConfigDataLocationResolver.java:199)
	at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:121)

I think .env file could be considered as properties file for spring.config.import .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions