![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring
落落叶叶无声
做过后端,现在主前端的开发工程师...
展开
-
执行插入操作后,如何返回自动增长的ID(Java)
问题(What):执行插入操作后,如何返回自动增长的ID解答(How):用JdbcTemplate提供的update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder)方法假设有表ACREATE TABLE TEST.A(ID INT NOT NULL PRIMARY KEY GENERATED BY原创 2016-02-23 18:56:29 · 7654 阅读 · 1 评论 -
Spring读取properties文件
property-placeholder标签<context:property-placeholder location="classpath:system-params-dev.properties" />相当于<bean class="org.springframework.beans.factory.config.PropertyPlaceholderC...原创 2018-03-12 21:16:50 · 214 阅读 · 0 评论 -
Spring-validator 校验器
Spring校验器的目的以下是Spring官方文档的解释There are pros and cons for considering validation as business logic, and Spring offers a design for validation (and data binding) that does not exclude either one of them.原创 2017-12-19 00:45:18 · 1520 阅读 · 0 评论 -
Spring IOC <context:annotation-config>与<context:component-scan/>
<context:annotation-config>使用<context:annotation-config> 会隐式地注册几个post-processors 包括 1. AutowiredAnnotationBeanPostProcessor, 2. CommonAnnotationBeanPostProcessor, 3. PersistenceAnnotationBeanPost原创 2017-12-14 19:22:45 · 193 阅读 · 0 评论 -
Spring bean @Required注解作用详解
作用@Required注解作用于Beansetter方法上,用于检查一个Bean的属性的值在配置期间是否被赋予或设置(populated)配置使用<context:annotation-config/>注册一个The RequiredAnnotationBeanPostProcessor,使@Required注解生效<?xml version="1.0" encoding="UTF-8"?><be原创 2017-12-12 18:34:23 · 12911 阅读 · 0 评论 -
Spring-Resource
FileSystemXmlApplicationContext适合测试环境配置。 Standalone XML application context, taking the context definition files from the file system or from URLs, interpreting plain paths as relative file system loc原创 2017-12-04 19:52:48 · 154 阅读 · 0 评论 -
Spring-AOP
配置<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.or原创 2017-12-04 17:50:40 · 193 阅读 · 0 评论 -
Spring注解@Resource和@Autowired区别对比
参考资料 https://www.cnblogs.com/think-in-java/p/5474740.html转载 2017-12-12 18:59:11 · 281 阅读 · 0 评论 -
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
Maven项目部署到Tomcat报错后启动报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener解决方法:右键点击项目–选择Properties,选择Deployment Assembly,在右边点击Add按钮,在弹出的窗口中选择Java Build Path Entries原创 2017-07-18 20:24:47 · 316 阅读 · 0 评论 -
Spring管理事务默认回滚的异常是什么?
问题:Spring管理事务默认(即没有rollBackFor的情况下)可以回滚的异常是什么?回答:RuntimeException或者Error。抛出运行时异常,是否回滚?Yes@Transactionalpublic void testTransationA(){ throw new RuntimeException();}抛出错误,是否回滚?Yes@Transac原创 2016-02-18 13:56:24 · 13633 阅读 · 4 评论 -
Spring-Testing @ContextConfiguration注解
@ContextConfiguration作用@ContextConfiguration defines class-level metadata that is used to determine how to load and configure an ApplicationContext for integration tests. Resolve pathCheck out t...原创 2018-04-03 12:25:04 · 1684 阅读 · 0 评论