springboot 学习
来源:互联网 发布:资源商城源码 编辑:程序博客网 时间:2024/06/09 21:21
关于springboot项目打jar包
1.指定 springboot启动类
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>com.thunisoft.wszz.Application</start-class>
</properties>
加入如下配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
3.java 调用python脚本
引用jar包
<dependency>
<groupId>org.python</groupId>
<artifactId>jython</artifactId>
<version>2.5.3</version>
</dependency>
编写java代码
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile("E:/add.py");
PyFunction func = (PyFunction) interpreter.get("adder", PyFunction.class);
int a = 2010, b = 6;
PyObject pyobj = func.__call__(new PyInteger(a), new PyInteger(b));
System.out.println("anwser = " + pyobj.toString());
python脚本:
add.py
def adder(a, b):
return a + b
4.springboot定时任务
@Configuration
@EnableScheduling
public class SchedulingConfig {
@Scheduled(cron = "0/10 * * * * ?")
// 每20秒执行一次
public void scheduler() {
System.out.println("定时任务在跑啦。。。。。。。。。。。。。");
}
}
- SpringBoot -SpringBoot学习
- springBoot学习
- SpringBoot学习
- SpringBoot学习
- springboot学习
- springBoot 学习
- springboot学习
- springboot 学习
- springboot学习
- Springboot学习
- springboot学习
- SpringBoot 学习
- SpringBoot学习篇---初见SpringBoot
- SpringBoot学习:SpringBoot整合mybatis
- SpringBoot 学习笔记
- SpringBoot 学习笔记 2
- springboot学习笔记(一)
- SpringBoot - Spring Security学习
- yii文件上传
- 恶意代码分析实战 安装INetSim在CentOS 7上
- LuoguP1063 能量项链
- SQL笔记:基本操作
- POJ 1836 Alignment
- springboot 学习
- Windows 10+Anaconda+Xgboost
- yii验证码
- 位移运算
- java的输入输出流
- spring boot(五):spring data jpa的使用
- Squid使用
- MyBatis在Oracle中插入数据并返回主键的问题解决
- linux下mysql5.7.19数据库备份(增量备份恢复)