Skip to content

Expose Path getters on ApplicationHome and ApplicationTemp#50194

Open
zxuhan wants to merge 2 commits intospring-projects:mainfrom
zxuhan:gh-50192-application-temp-path
Open

Expose Path getters on ApplicationHome and ApplicationTemp#50194
zxuhan wants to merge 2 commits intospring-projects:mainfrom
zxuhan:gh-50192-application-temp-path

Conversation

@zxuhan
Copy link
Copy Markdown
Contributor

@zxuhan zxuhan commented Apr 23, 2026

ApplicationTemp already uses java.nio.file.Path internally but only exposes java.io.File via getDir() / getDir(String). Callers that want to use the NIO Files API have to round-trip through getDir().toPath().

This change makes getPath() public and adds getPath(String subDir) to mirror the existing getDir methods.

Closes gh-50192

Closes spring-projectsgh-50192

Signed-off-by: zxuhan7 <zxuhan7@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 23, 2026
Copy link
Copy Markdown
Member

@philwebb philwebb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I've added some comments for review. Are you also interested in updating the PR to add similar code to ApplicationHome?

/**
* Return the path to be used for application specific temp files.
* @return the application temp path
* @since 4.1.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't make 4.1.0 because we're already at RC. We can consider it for 4.2.0.

* @return the subdirectory path
* @since 4.1.0
*/
public Path getPath(String subDir) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add this. The user can do temp.path().resolve(...) directly.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue labels Apr 24, 2026
- Update @SInCE to 4.2.0 on ApplicationTemp.getPath()
- Remove getPath(String subDir) per review
- Add getPath() and getSourcePath() to ApplicationHome

See spring-projectsgh-50192

Signed-off-by: zxuhan7 <zxuhan7@gmail.com>
@zxuhan
Copy link
Copy Markdown
Contributor Author

zxuhan commented Apr 24, 2026

Thanks for the review! Updated:

  • Bumped @since to 4.2.0 on ApplicationTemp.getPath()
  • Removed getPath(String subDir) — callers can use getPath().resolve(...)
  • Added getPath() and getSourcePath() (nullable) to ApplicationHome, with tests

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 24, 2026
@wilkinsona wilkinsona changed the title Expose Path getters on ApplicationTemp Expose Path getters on ApplicationHome and ApplicationTemp Apr 24, 2026
@snicoll snicoll added this to the 4.x milestone Apr 25, 2026
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider exposing Path getter in ApplicationTemp

4 participants