上一页 1 2 3 4 5 6 7 ··· 33 下一页
摘要: 在Jpa里, 当我们在定义多个实体类时, 可能会遇到这几个实体类都有几个共同的属性, 这时就会出现很多重复代码. 这时我们可以选择编写一个父类,将这些共同属性放到这个父类中, 并且在父类上加上@MappedSuperclass注解.注意:标注为@MappedSuperclass的类将不是一个完整的实 阅读全文
posted @ 2020-10-09 12:58 杨斌_济南 阅读(158) 评论(0) 推荐(0) 编辑
摘要: @EnableTransactionManagement Spring Boot 使用事务非常简单,首先使用注解 @EnableTransactionManagement 开启事务支持后, 然后在访问数据库的Service方法上添加注解 @Transactional 便可。 阅读全文
posted @ 2020-10-09 12:57 杨斌_济南 阅读(155) 评论(0) 推荐(0) 编辑
摘要: @ConfigurationProperties是springboot提供读取配置文件的一个注解。 阅读全文
posted @ 2020-10-09 12:56 杨斌_济南 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Spring getBeanDefinitionNames方法:获取JavaBean名称 该方法用于获取 Spring 容器中定义的所有 JavaBean 的名称。 语法: getBeanDefinitionNames() 返回值:Spring 容器中所有 JavaBean 的名称,返回类型是一个字 阅读全文
posted @ 2020-10-09 11:48 杨斌_济南 阅读(1213) 评论(0) 推荐(0) 编辑
摘要: ApplicationContext是什么? 简单来说就是Spring中的容器,可以用来获取容器中的各种bean组件,注册监听事件,加载资源文件等功能。 Application Context获取的几种方式 1 直接使用Autowired注入 @Component public class Book 阅读全文
posted @ 2020-10-09 11:46 杨斌_济南 阅读(5519) 评论(0) 推荐(0) 编辑
摘要: public void run(String... args),最重要的是:这个方法会在应用程序启动后首先被调用。 那种只需要在应用程序启动时执行一次的任务,非常适合利用Command line runners来完成。 Spring Boot应用程序在启动后,会遍历CommandLineRunner 阅读全文
posted @ 2020-10-09 11:44 杨斌_济南 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 1、新建一个新的Maven Project; 2、需要在pom.xml文件添加相应的依赖, 比如:mysql驱动; PageHelper分页插件,需要版本号; 3、编写启动类,大部分和之前的代码是一样的,需要的注意的是: 需要添加一个注解@MapperScan --指定MyBatis持久类的位置; 阅读全文
posted @ 2020-10-09 11:38 杨斌_济南 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 在pom.xml文件添加依赖 <!-- spring boot parent节点,引入这个之后,在下面和spring boot相关的就不需要引入版本了; --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spri 阅读全文
posted @ 2020-10-09 11:36 杨斌_济南 阅读(193) 评论(0) 推荐(0) 编辑
摘要: •操作步骤 •(1)在pom.xml中引入thymeleaf; •(2)如何关闭thymeleaf缓存 •(3)编写模板文件.html •(4)编写访问模板文件controller 在pom.xml加入thymeleaf的依赖: <dependency> <groupId>org.springfra 阅读全文
posted @ 2020-10-09 11:34 杨斌_济南 阅读(134) 评论(0) 推荐(0) 编辑
摘要: spring boot默认的json使用起来比较不习惯,所以很自然我就想我能不能使用fastjson进行json解析呢? 引入fastjson依赖库 <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactI 阅读全文
posted @ 2020-10-09 11:32 杨斌_济南 阅读(592) 评论(0) 推荐(0) 编辑
摘要: 在一个项目中的异常我们我们都会统一进行处理的,那么如何进行统一进行处理呢? 新建一个类GlobalDefaultExceptionHandler, 在class注解上@ControllerAdvice, 在方法上注解上@ExceptionHandler(value = Exception.class 阅读全文
posted @ 2020-10-09 11:29 杨斌_济南 阅读(164) 评论(0) 推荐(0) 编辑
摘要: •(1) 在pom.xml加入jdbcTemplate的依赖; •(2) 编写DemoDao类,声明为:@Repository,引入JdbcTemplate •(3) 编写DemoService类,引入DemoDao进行使用 •(4) 编写Demo2Controller进行简单测试。编写Demo2C 阅读全文
posted @ 2020-10-09 11:26 杨斌_济南 阅读(127) 评论(0) 推荐(0) 编辑
摘要: •Spring Data JPA能干什么 •可以极大的简化JPA的写法,可以在几乎不用写实现的情况下,实现对数据的访问和操作。除了CRUD外,还包括如分页、排序等一些常用的功能。 • 首先我们需要清楚的是Spring Data是一个开源框架,在这个框架中Spring Data JPA只是这个框架中的 阅读全文
posted @ 2020-10-09 11:22 杨斌_济南 阅读(102) 评论(0) 推荐(0) 编辑
摘要: •添加依赖包: •<dependency> • <groupId>org.springframework.boot</groupId> • <artifactId>spring-boot-devtools</artifactId> • <optional>true</optional> • <sco 阅读全文
posted @ 2020-10-09 11:21 杨斌_济南 阅读(246) 评论(0) 推荐(0) 编辑
摘要: •在pom.xml文件添加依赖包: <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin </artifactId> <dependencies> <dependency> 阅读全文
posted @ 2020-10-09 11:18 杨斌_济南 阅读(145) 评论(0) 推荐(0) 编辑
摘要: springboot作用:整合了所有的第3方Java框架配置,并设定了默认配置。 类似于Android中的Gradle配置第3芳的类库、或者类似于node中的npm安装第3方的库,插件配置形式。 例子: <project xmlns="http://maven.apache.org/POM/4.0. 阅读全文
posted @ 2020-10-09 11:13 杨斌_济南 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 报:No active profile set, falling back to default profiles: default 是因为引用的springboot的版本不对 原来是 <parent> <groupId>org.springframework.boot</groupId> <art 阅读全文
posted @ 2020-10-04 16:57 杨斌_济南 阅读(2374) 评论(0) 推荐(0) 编辑
摘要: 1 ReMap parmMap = new ReMap(); 2 Map<String, String[]> uriAttributes = request.getParameterMap(); 3 for (Map.Entry<String, String[]> attr : uriAttribu 阅读全文
posted @ 2020-09-03 17:00 杨斌_济南 阅读(343) 评论(0) 推荐(0) 编辑
摘要: Spring Boot做文件上传时出现了The field file exceeds its maximum permitted size of 1048576 bytes.错误,显示文件的大小超出了允许的范围。查看了官方文档,原来Spring Boot工程嵌入的tomcat限制了请求的文件大小,这 阅读全文
posted @ 2020-08-24 17:52 杨斌_济南 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 1 在拦截器里拦截之后跳转到登录页 public class ActionInterceptor implements Interceptor { @Override public void intercept(Invocation inv) { HttpSession session = inv. 阅读全文
posted @ 2020-08-11 18:48 杨斌_济南 阅读(466) 评论(0) 推荐(0) 编辑
摘要: st_lock_deviceconfig 依赖 st_lock_areaconfig 数据应该先有 一侧表的,后有一侧表的数据。 阅读全文
posted @ 2020-07-13 17:50 杨斌_济南 阅读(235) 评论(0) 推荐(0) 编辑
摘要: MySQL 支持 replace into 例子:REPLACE INTO `st_controlmodule` (id,cname,cip,cport,cdesc,cstate) VALUES ('1281029966208831488','3.79安防通用模型_YB测试B03','192.168 阅读全文
posted @ 2020-07-09 13:16 杨斌_济南 阅读(363) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-07-08 10:02 杨斌_济南 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 使用谷歌浏览器的F12、Sources下,找到页面引用的js文件的方法 阅读全文
posted @ 2020-04-11 10:25 杨斌_济南 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 数据表是这种,具有父子级关系 1、最顶层调用处 List<ReMap> deviceRMLt = new ArrayList<>(); deviceRMLt = DeviceModel.getRecursionDeviceLt(1,null,pmap); dataMap.put(Ckey.Pc.LI 阅读全文
posted @ 2020-04-08 10:57 杨斌_济南 阅读(628) 评论(0) 推荐(0) 编辑
摘要: 单击 工具-"编辑WCF配置", 之后就出现了。 阅读全文
posted @ 2020-03-15 23:03 杨斌_济南 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 获取参数: 阅读全文
posted @ 2020-02-21 16:19 杨斌_济南 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 在java中可以使用jna 加载dll,或者so文件 例如 在项目中的文件目录 需要在pom文件中引用 阅读全文
posted @ 2019-12-30 09:43 杨斌_济南 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 1 先创建线程组 2 创建Http请求 3 设置http请求 4 设置查看结果树 5执行查看结果 阅读全文
posted @ 2019-08-30 13:48 杨斌_济南 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-07-26 22:50 杨斌_济南 阅读(558) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 33 下一页