SpringMvc注解 环境准备 导入依赖 <dependencies> <!--spring核心依赖--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <ve ...
分类:
编程语言 时间:
2020-07-30 22:12:17
阅读次数:
69
记一次Spring Boot项目整合 JavaMailSender 发送电子邮件配置异常调试经验。 ...
分类:
其他好文 时间:
2020-07-30 22:08:37
阅读次数:
173
一个方法加上@Transactional(rollbackFor=Exception.class)不生效 查找结果如下: 1.@Transactional是基于AOP动态代理做的,所以方法必须是public;其他的修饰符不生效。 2.Spring事务控制器在catch里面做了判断只有RuntimeE ...
分类:
其他好文 时间:
2020-07-30 18:25:37
阅读次数:
73
读取配置文件 在以前的项目中我们主要在 XML 文件中进行框架配置,业务的相关配置会放在属性文件中, 然后通过一个属性读取的工具类来读取配置信息。在 Spring Boot 中我们不再需要使用这种方式去读取数据了。 Spring Boot 中的配置通常放在 application.propertie ...
分类:
编程语言 时间:
2020-07-30 18:24:49
阅读次数:
112
1. Spring与Web环境集成 1.1 ApplicationContext应用上下文获取方式 应用上下文对象是通过new ClasspathXmlApplicationContext(spring配置文件) 方式获取的,但是每次从容器中获得Bean时都要编写new ClasspathXmlAp ...
分类:
编程语言 时间:
2020-07-30 18:20:11
阅读次数:
66
Spring Cloud 学习记录 参考资料: SpringCloud 与 SpringBoot 版本对应 SpringCloud 与 SpringBoot 版本对应 Release Trains ...
分类:
编程语言 时间:
2020-07-30 18:18:24
阅读次数:
65
1、创建定时任务: @Component public class AutoNotifyController { /** * 获取RedisUtils注入的bean * * @return */ private ThreadUtil getThreadUtil() { ThreadUtil thre ...
分类:
编程语言 时间:
2020-07-30 16:53:27
阅读次数:
71
整合必备的依赖 <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.4</version> </dependency> <depe ...
分类:
编程语言 时间:
2020-07-30 16:44:11
阅读次数:
57
前言 本节我们将学习一下@PostConstruct的用法。 概述 @PostContruct是spring框架的注解,在方法上加该注解会在项目启动的时候执行该方法,也可以理解为在spring容器初始化的时候执行该方法。 /** * 项目启动时,初始化定时器 */ @PostConstruct pu ...
分类:
编程语言 时间:
2020-07-30 14:39:59
阅读次数:
100
一.源码环境的搭建: @Component @Scope(scopeName = ConfigurableBeanFactory.SCOPE_SINGLETON,proxyMode = ScopedProxyMode.TARGET_CLASS) public class MyMath impleme ...
分类:
编程语言 时间:
2020-07-30 14:24:46
阅读次数:
64