SpringBoot 笔记

(1) SpringBoot以JSON格式返回对象

<dependency>
	<groupId>com.fasterxml.jackson.core</groupId>
	<artifactId>jackson-core</artifactId>
	<version>${jackson.version}</version>
</dependency>
 
<dependency>
	<groupId>com.fasterxml.jackson.core</groupId>
	<artifactId>jackson-databind</artifactId>
	<version>${jackson.version</version>
</dependency>
 
<dependency>
	<groupId>com.fasterxml.jackson.core</groupId>
	<artifactId>jackson-annotations</artifactId>
	<version>${jackson.version</version>
</dependency>

(2) springboot hot deploy

  1. 添加对应jar包

  2. 添加插件

  3. 配置idea

  4. mvn dependencies 添加以下依赖

    <!-- add hot deployment -->
    <dependency>
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-devtools</artifactId>
    	<optional>true</optional>
    	<scope>runtime</scope>
    </dependency>
  5. build的时候添加以下plug

    <plugin>
    	<!-- hot deployment config -->
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-maven-plugin</artifactId>
    	<configuration>
    		<fork>true</fork>
    	</configuration>
    </plugin>
  6. 配置idea

  7. 1 File -> Settings -> Compiler 勾选 Build Project automatically

  8. 2 双击 Shift,输入 registry , 点击 Registry.. ,勾上 compiler.automake.allow.when.app.running

Allow auto-make to start even if developed application is currently running. Note that automatically started make may eventually delete some classes that are required by the application.

References

[1] Spring Boot Reference Documentation
[2] using-spring-boot
[3] spring-boot
[4] spring.io
[5] Spring Boot 学习笔记:以JSON格式返回对象
[6] springboot+idea热部署(自动刷新)
[7] spring-boot 速成(2) devtools之热部署及LiveReload