spring-projects / spring-projects/spring-boot
Support .env file for configuration properties
Open
Nobody has claimed this yet.
status: pending-design-work
type: enhancement
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
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 .
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the optional .env import shown in the issue, then start at StandardConfigDataLocationResolver.java:199 and trace how the location is classified. Done means the .env location is accepted as configuration properties without the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100