@RestController
@EnableAutoConfiguration
public class Example {
@RequestMapping("/")
public String home() {
return "Hello World";
}
public static void main(String[] args) {
/**
* SpringApplication会自动加载application.properties文件,具体的加载路径包含以下:
* <p>
* 1. A <b>/config</b> subdirectory of the current directory;
* <p/>
* <p>
* 2. The Current Directory
* </p>
* <p>
* 3. A classpath /config package
* </p>
* <p>
* 4. The classpath root.
* </p>
*/
SpringApplication.run(Example.class, args);
}
}
java -jar jar_path --param
java -jar emample.jar --server.port=8081
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--<version>${spring.boot.version}</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<goals>-->
<!--<goal>repackage</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
</plugin>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<!--<groupId>com.spring.sourcecode</groupId>-->
<!--<artifactId>learn.spring</artifactId>-->
<!--<version>1.0-SNAPSHOT</version>-->
</parent>
mvn spring-boot:run
mvn spring-boot:help -Ddetail
mvn spring-boot:run -Drun.arguments="--server.port=8888"