ich einen Krieg Paket haben und wollte einen externen Classpath enthalten:Lauf Classpath in externen Ordner WAR-Datei Befehl Frühling java
in meinem Controller:
Ich habe diesen Code ein:
WebApplication Klasse:
@SpringBootApplication
@PropertySource("classpath:config.properties")
public class WebApplication{
public static void main(String[] args){
SpringApplication.run(WebApplication.class, args);
}
}
Controller-Klasse:
@Controller
@PropertySource("classpath:config.properties")
public class ApplicationController{
//doing some stuff here
}
mein Ordner:
|-project
|-src |-main |-java |-com.mypage.temp |-WebApplication.java (main class) |-com.mypage.temp.controller |-ApplicationController (Controller) |-resources |- [some stuff & not putting my properties file here to include externally] |-deploy |-config.properties
Allerdings, wenn ich
project.war
Ich habe in einem Remote-Server (Unix) bauen:
|project
|-bin |-project.war |-config |-config.properties
Something/something/something/bin/project.war Something/something/something/config/config.properties
Startbefehl:
java -jar -Dclasspath=/something/something/something/config/config.properties project.war
Fehler:
Failed to parse configuration class [com.mypage.temp.WebApplication];
nested exception is java.io.FileNotFoundException: class path resource
[config.properties] cannot be opened because it does not exist
2016-12-19 18:13:16.763 ERROR 21662 --- [ main]
o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to
parse configuration class [com.mypage.temp.WebApplication]; nested
exception is java.io.FileNotFoundException: class path resource
[config.properties] cannot be opened because it does not exist
es nicht – isme
funktioniert Welches ist Ihr Betriebssystem ist? – davidxxx
Unix ist mein Betriebssystem – isme