当前位置:网站首页 > C++编程 > 正文

junit包怎么导入(junit包怎么导入eclipse)



<?xml version="1.0" encoding="UTF-8"?>


4.0.0

org.springframework.boot
spring-boot-starter-parent
2.4.1


com.ls
boot-mybatis-javafx
0.0.1-SNAPSHOT
boot-mybatis-javafx
boot-mybatis-javafx











 
  

2.application.yml内容
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
url: jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
mybatis:
mapper-locations: classpath:com/ls/mapper/*.xml
3.启动类BootMybatisJavafxApplication.java内容
由于@FXMLController控制器无法由spring管理,所用@Autowire无法自动注入,写了一个静态方法getContext获取上下文,再通过getBean()获取指定的bean
package com.ls.bootmybatisjavafx;










import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;









@SpringBootApplication
@MapperScan(value = {“com.ls.bootmybatisjavafx.mapper”}) // mybatis扫包
public class BootMybatisJavafxApplication extends Application {

 
  

}

4.Login.fxml内容(此文件放在resources目录下)

通过idea右键创建后 鼠标移动到文件 右键 Open In SceneBuilder 打开后在SceneBuilder 画图保存后会在当前文件自动生成代码(前提是吧SceneBuilder整合进idea)

<?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Button?> <?import javafx.scene.control.PasswordField?> <?import javafx.scene.control.TextField?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.text.Font?> <?import javafx.scene.text.Text?>

import com.ls.bootmybatisjavafx.BootMybatisJavafxApplication;
import com.ls.bootmybatisjavafx.mapper.UserMapper;
import com.ls.bootmybatisjavafx.vo.User;
import de.felixroske.jfxsupport.FXMLController;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.DialogPane;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;













 
  

}
6.User.java内容
package com.ls.bootmybatisjavafx.vo;
import lombok.Data;
import java.io.Serializable;



 
  

}

7.UserMapper内容
package com.ls.bootmybatisjavafx.mapper;
import com.ls.bootmybatisjavafx.vo.User;
import org.apache.ibatis.annotations.Mapper;


import java.util.List;
@Mapper
public interface UserMapper {
User login(User tmp);
int register(User tmp);
int selectByName(User tmp);
}





三、运行截图

四、数据库sql文件内容
create table demo.user
(
user_id int(32) auto_increment comment ‘用户id’
primary key,
user_name varchar(32) null comment ‘用户名称’,
user_password varchar(32) null comment ‘用户密码’,





);

到此这篇junit包怎么导入(junit包怎么导入eclipse)的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • lxc源码(lxc源码分析)2025-09-12 14:18:07
  • tcp工具支持ipv6吗?(tcp/ipv6)2025-09-12 14:18:07
  • 数组方法splice()的参数(数组中splice的用法)2025-09-12 14:18:07
  • bigboss源空白解决办法(解决cydia bigboss源空白)2025-09-12 14:18:07
  • gitclone怎么用(git clone -l)2025-09-12 14:18:07
  • dhc英文怎么读(dohc怎么读)2025-09-12 14:18:07
  • c++单向链表逆序(单链表逆序c语言)2025-09-12 14:18:07
  • cnn无监督分类(无监督分类算法有哪些)2025-09-12 14:18:07
  • console线和串口线一样吗(串口和console口的区别)2025-09-12 14:18:07
  • vbac名词解释(bsc名词解释)2025-09-12 14:18:07
  • 全屏图片