I'm trying to assign a String
variable to a system property fetched from the application.properties
in main method. But it gives me
Cannot make a static reference to the non-static field LOG_FILE
This is my code snippet, what is the mistake I'm making here?
@SpringBootApplication
public class MqMessageHandlerApplication {
@Value("${logging.home.file}")
String LOG_FILE;
public static void main(String[] args) {
//System.setProperty("LOG_DIR", "D:\\mq-message-handler-1.0\\logs\\" );
System.setProperty("LOG_DIR", LOG_FILE );
SpringApplication.run(MqMessageHandlerApplication.class, args);
}
}