一、SpringBoot整合Junit

点击查看代码
package com.huawei;
import com.huawei.hello.SpringbootTestApplication;
import com.huawei.hello.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* 功能描述
*
* @author n00568290
* @since 2022-03-01
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringbootTestApplication.class)
public class UserServiceTest {
@Autowired
private UserService userService;
@Test
public void testAdd() {
userService.add();
}
}
二、SpringBoot整合Redis

、、