Merge remote-tracking branch 'remotes/origin/dev' into test
# Conflicts: # modules/i3plus-core-apiservice/src/main/resources/application.propertiesyun-zuoyi
commit
845b493c3c
@ -0,0 +1,41 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.thread;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-07-03 10:56
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public class Demo {
|
||||||
|
/*定义一个全局变量 来存放线程需要的变量*/
|
||||||
|
public static ThreadLocal<Integer> ti = new ThreadLocal<Integer>();
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("主线程:" + Thread.currentThread().getName());
|
||||||
|
/*创建两个线程*/
|
||||||
|
for(int i=0; i<2;i++){
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Double d = Math.random()*10;
|
||||||
|
/*存入当前线程独有的值*/
|
||||||
|
// ti.set(d.intValue());
|
||||||
|
new A().get();
|
||||||
|
new B().get();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static class A{
|
||||||
|
public void get(){
|
||||||
|
/*取得当前线程所需要的值*/
|
||||||
|
System.out.println(this.getClass()+ "---"+ Thread.currentThread().getName()+"-------"+ti.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static class B{
|
||||||
|
public void get(){
|
||||||
|
/*取得当前线程所需要的值*/
|
||||||
|
System.out.println(this.getClass()+ "---"+ Thread.currentThread().getName()+"-------"+ti.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysToolService;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ImppSwitchUtil;
|
||||||
|
import cn.estsh.impp.framework.run.ImppGo;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2020-06-09 11:51
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@SpringBootTest(classes = ImppGo.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class SysToolServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysToolService sysToolService;
|
||||||
|
|
||||||
|
@Value("${impp.init.lazy.global:false}")
|
||||||
|
private String lazyInit;
|
||||||
|
// @Autowired
|
||||||
|
// private ISystemInitService systemInitService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void insertSysTool() {
|
||||||
|
// systemInitService.putAndLoadAll();
|
||||||
|
System.out.println("unit"+ImppSwitchUtil.isUnitTestEnv());
|
||||||
|
System.out.println("lazyInit"+lazyInit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void listSysTool() {
|
||||||
|
sysToolService.listSysTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue