Map<String,String> verityMap=new HashMap<>();
new Thread(new Runnable() {
@SneakyThrows
public void run() {
IRS_sdkTest.sdkTest();
}
}).start();
List<String> testList = new ArrayList<String>();
for (int i = 0; i < 6; i++)
testList.add("baiqi");
String tempString = StringUtils.join(testList, ";");
List<String> testList2 = Arrays.asList(tempString.split(";"));
System.out.println("tempString: " + tempString);
System.out.println("testList2: " + testList2.toString());
Integer.valueOf(str).intValue()
Date date = new Date();
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
String currrentTime=dateFormat.format(date);
时间函数
延时
Thread.currentThread().sleep(10000);
定时每分钟
upload.Scheduled.time:0 */1 * * * ?
@Scheduled(cron = "${upload.Scheduled.time}") //每10秒执行一次
public void scheduledTaskByCorn() {
log.info("定时任务开始 ByCorn:" + new Date());
scheduledTask();
log.info("定时任务结束 ByCorn:" + new Date());
}
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
private static final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("win");
Read timed out
@Bean
public RestTemplate restTemplate() {
//复杂构造函数的使用
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(600000);// 设置超时
requestFactory.setReadTimeout(600000);
RestTemplate restTemplate = new RestTemplate();
restTemplate.setRequestFactory(requestFactory);
return restTemplate;
}
jdbcTemplate
jdbcTemplate.update("UPDATE USER SET name = ? WHERE user_id = ?", new Object[] {name, id});
jdbcTemplate.update("INSERT INTO USER VALUES(?, ?, ?, ?)", new Object[] {user.getId(), user.getName(), user.getSex(), user.getAge()});
控制日志输出
<configuration>
<logger name="org.apache" level="WARN" />
<logger name="httpclient" level="WARN" />
</configuration>
查找配置文件路径
ApplicationHome home = new ApplicationHome(getClass());
File jarFile = home.getSource();
String ApplicationHomePath = jarFile.getParent();
System.out.println("ApplicationHomePath"+ApplicationHomePath);
String studentPathC1=Thread.currentThread().getContextClassLoader().getResource(fileName).getPath();
System.out.println("c1 path: "+studentPathC1);
File fileStudent = new File(studentPathC1);
if(!fileStudent.exists()){
fileStudent = new File(ApplicationHomePath+"\\classes\\"+fileName);
}
//System.loadLibrary("libJavaForJniDemo");
// System.load("libJavaForJniDemo.dll");
elastticSearch参考
Node.js安装及环境配置之Windows篇
windows下安装ElasticSearch5.X head插件
java-代码片段
最新推荐文章于 2024-08-06 08:02:30 发布