随笔分类 - Spring
摘要:依赖于spring boot注解@scheduled和@EableScheduling实现定时任务功能。 使用方式很简单,两步就搞定了,如下: 1:在spring boot项目的启动类中加入@EableScheduling注解,表示启用工作计划。 pic-1590656781868.png 2:在需
阅读全文
摘要:总共修改两个文件: 1:pom.xml文件。 2:springboot的启动类。 具体修改步骤: 1:springboot项目,默认的打包方式是jar包,将pom.xml文件头部的jar改成war pic-1590656512007.png (要是没有<packaging></packaging>标
阅读全文
摘要:springboot 1.5.x server.context-path=/center // 应用上下文,在所有的controller之前 server.servlet-path=*.html // 拼接在controller后面,eg:http://localhost:8080/center/i
阅读全文
摘要:1:controller层方法传参 pic-1590654577197.png 在上图的方法中,需要调用这个方法的话,那么a参数是必传的,b和c无所谓传不传,甚至是你传一个方法中没有的参数d也是可以正常调用该方法的。总之是有类似上面的注解@RequestParam的参数必传,其余的看逻辑需求(一般逻
阅读全文
摘要:1:在pom文件中引入依赖。 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> 2:在pojo层的实
阅读全文
摘要:1:在pom文件中引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> 2:编写AOP类,在类上使用@A
阅读全文
摘要:SpringBoot装配 bean到ioc容器中的两种方法。 1:使用@Configuration和@Bean注解,扫描bean和装配bean到ioc容器中。 pic-1590653103739.png 2:使用@Component和@ComponentScan注解,扫描启动类包下及子包下的所有be
阅读全文
摘要:参考: https://blog.csdn.net/wu631464569/article/details/51898871 一、jdbc.properties的主要内容主要是数据库连接和配置的一些基本信息,如下图: 二、 在applicationContext.xml中怎么读取jdbc.prope
阅读全文