Like the Title says, my @Value doesn't passes a value
I've written the following in my application.properties:
project:
image:
path= "C:\\Users\\...."
I've got a Class Configuration
@Component
public class Configuration{
@Value("${project.image.path}")
public static String ImagePath;
}
In my Other class called Image I want to convert the String path to a File, so that I can work with this value later:
public class Image{
static File Directory= new File (Configuration.ImagePath);
}
The Problem is, when I use my programm and one of the Methods is used, where the variable Directory is used(which are all written in the Image class), I get a NullPointerException: null and strangely when I refresh the site after the error occurs one time, the error now says NoClassDefFoundError: Could not initialize class com.Project.Image