Y.yi
Y.yi

Reputation: 13

spring boot error The system cannot find the specified file

my properties in:
---resources
-------parkSpace.properties
and,I used FileInputStream to read the prpperties:

public static Map<String,String> get(){
    InputStream in = new BufferedInputStream(new FileInputStream("parkSpace.properties"));
}

why occurred 'the system cannot find the path'? ths.

Upvotes: 0

Views: 2417

Answers (1)

Liping Huang
Liping Huang

Reputation: 4476

You should get the resource from classloader, using this.getClass().getClassLoader().getResourceAsStream(String name) instead.

With spring frmework, Spring’s Resource interface is meant to be a more capable interface for abstracting access to low-level resources.

Reference

Resources.

Upvotes: 2

Related Questions