Skip to content

Commit

Permalink
增加 springboot lombok
Browse files Browse the repository at this point in the history
增加 springboot 热部署(热更替)
  • Loading branch information
YunaiV committed Feb 4, 2020
1 parent 036a861 commit 5cd2a6e
Show file tree
Hide file tree
Showing 18 changed files with 262 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@

## 打好基础

* [《芋道 Spring Boot 快速入门》](http://www.iocoder.cn/Spring-Boot/quick-start/?github)
* [《芋道 Spring Boot 自动配置原理》](http://www.iocoder.cn/Spring-Boot/autoconfigure/?github) 对应 [lab-47](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-47)

## 开发工具

* [《芋道 Spring Boot 热部署入门》](http://www.iocoder.cn/Spring-Boot/hot-swap/?github) 对应 [lab-48](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-48)
* [《芋道 Spring Boot 消除冗余代码 Lombok 入门》](http://www.iocoder.cn/Spring-Boot/Lombok/?github) 对应 [lab-49](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-49)
* 《芋道 Spring Boot 对象转换 MapStruct 入门》计划中...

## Web 开发

* [《芋道 Spring Boot SpringMVC 入门》](http://www.iocoder.cn/Spring-Boot/SpringMVC/?github) 对应 [lab-23](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-23)
Expand Down
5 changes: 5 additions & 0 deletions lab-09/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@

<artifactId>lab-09</artifactId>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>

</project>
1 change: 0 additions & 1 deletion lab-46/lab-46-sentinel-demo-nacos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<artifactId>lab-46-sentinel-demo-nacos</artifactId>

<dependencies>

<!-- 实现对 SpringMVC 的自动化配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
23 changes: 23 additions & 0 deletions lab-48/lab-48-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>lab-48-demo</artifactId>

<dependencies>
<!-- 实现对 SpringMVC 的自动化配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cn.iocoder.springboot.lab48.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cn.iocoder.springboot.lab48.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/demo")
public class DemoController {

@GetMapping("/echo")
public String echo() {
return "echo";
}

}
19 changes: 19 additions & 0 deletions lab-48/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>labs-parent</artifactId>
<groupId>cn.iocoder.springboot.labs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>lab-48</artifactId>
<packaging>pom</packaging>
<modules>
<module>lab-48-demo</module>
</modules>


</project>
37 changes: 37 additions & 0 deletions lab-49/lab-49-lombok-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>lab-49-lombok-demo</artifactId>

<dependencies>
<!-- 引入 Spring Boot Starter 基础库 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<!-- 引入 Lombok 依赖 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<!-- 实现对 Test 的自动化配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cn.iocoder.springboot.lab49.lombokdemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class LombokApplication {

public static void main(String[] args) {
// 启动 Spring Boot 应用
SpringApplication.run(LombokApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cn.iocoder.springboot.lab49.lombokdemo.dataobject;

import lombok.Getter;
import lombok.Setter;

/**
* 用户 DO
*/
@Setter
@Getter
public class UserDO {

private String username;
private String password;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cn.iocoder.springboot.lab49.lombokdemo.dataobject;

import lombok.Data;

/**
* 用户 DO
*/
@Data
public class UserDO01 {

private String username;
private String password;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cn.iocoder.springboot.lab49.lombokdemo.service;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserService {

public static void staticMethod() {
log.info("静态方法示例");
}

public void normalMethod() {
log.info("普通方法示例");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cn.iocoder.springboot.lab49.lombokdemo.service;

import cn.iocoder.springboot.lab49.lombokdemo.dataobject.UserDO;
import com.sun.istack.internal.NotNull;
import lombok.NonNull;
import org.springframework.stereotype.Service;

@Service
public class UserService01 {

@NonNull
public void test01(UserDO userDO) {
System.out.println(userDO.getUsername());
System.out.println(userDO.getPassword());
}

public void test02(@NotNull String username, String password) {

}

public void test03() {
@NonNull String username = "";
String password = "";
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cn.iocoder.springboot.lab49.lombokdemo.dataobject;

import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class UserDOTest {

@Test
public void demo01() {
UserDO user = new UserDO();
user.setUsername("username:1");
user.setPassword("password:1");
System.out.println(user);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package cn.iocoder.springboot.lab49.lombokdemo;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cn.iocoder.springboot.lab49.lombokdemo.service;

import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class UserService01Test {

private UserService01 userService01 = new UserService01();

@Test
public void test02() {
userService01.test02(null, null);
}

}
19 changes: 19 additions & 0 deletions lab-49/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>labs-parent</artifactId>
<groupId>cn.iocoder.springboot.labs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>lab-49</artifactId>
<packaging>pom</packaging>
<modules>
<module>lab-49-lombok-demo</module>
</modules>


</project>
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
<module>lab-45</module>
<module>lab-46</module>
<module>lab-47</module>
<module>lab-48</module>
<module>lab-49</module>
</modules>


</project>

0 comments on commit 5cd2a6e

Please sign in to comment.