提交 6452d51b authored 作者: guilai.ming's avatar guilai.ming

Initial commit

上级
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.notemap</groupId>
<artifactId>hip-management</artifactId>
<version>0.1</version>
<name>hip-management</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.notemap.demo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
@SpringBootApplication
@Slf4j
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
log.info("Run timerTask:" + new Date());
}
};
Timer timer = new Timer();
timer.schedule(timerTask, 1000, 3000);
}
}
package com.notemap.demo.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
/**
* @author wz
* @date 2021-05-13 13:41
*/
@RestController
@RequestMapping("api/v1/ruby")
@Slf4j
public class DemoController {
@GetMapping("/user")
public String testUser(){
String[] args = new String[0];
main(args);
return "success";
}
// public static void main(String[] args) {
// TimerTask timerTask = new TimerTask() {
// @Override
// public void run() {
// log.info("Run timerTask:" + new Date());
// }
// };
// Timer timer = new Timer();
// timer.schedule(timerTask, 1000, 3000);
// }
public static void main(String[] args) {
// Byte aByte=new Byte("[123, 34, 107, 105, 110, 100, 34, 58, 34, 83, 116, 97, 116, 117, 115, 34, 44, 34, 97, 112, 105, 86, 101, 114, 115, 105, 111, 110, 34, 58, 34, 118, 49, 34, 44, 34, 109, 101, 116, 97, 100, 97, 116, 97, 34, 58, 123, 125, 44, 34, 115, 116, 97, 116, 117, 115, 34, 58, 34, 70, 97, 105, 108, 117, 114, 101, 34, 44, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 34, 112, 111, 100, 115, 32, 92, 34, 100, 112, 99, 115, 49, 50, 51, 45, 51, 92, 34, 32, 110, 111]");
// byte b = aByte.byteValue();
// System.out.println(aByte.toString());
byte [] bytes=new byte[] { 123, 34, 107, 105, 110, 100, 34, 58, 34, 83, 116, 97, 116, 117, 115, 34, 44, 34, 97, 112, 105, 86, 101, 114, 115, 105, 111, 110, 34, 58, 34, 118, 49, 34, 44, 34, 109, 101, 116, 97, 100, 97, 116, 97, 34, 58, 123, 125, 44, 34, 115, 116, 97, 116, 117, 115, 34, 58, 34, 70, 97, 105, 108, 117, 114, 101, 34, 44, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 34, 112, 111, 100, 115, 32, 92, 34, 100, 112, 99, 115, 49, 50, 51, 45, 51, 92, 34, 32, 110, 111};
String s = bytes.toString();
String s1 = new String(bytes);
System.out.println(s);
System.out.println(s1);
}
}
差异被折叠。
package com.notemap.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论