posts - 88,comments - 7,views - 22万

随笔分类 -  spring

spring项目获取ApplicationContext(能手动从Spring获取所需要的bean)
摘要:最流行的方法就是 实现ApplicationContextAware接口 @Component public class SpringContextUtil implements ApplicationContextAware { private static ApplicationContext 阅读全文
posted @ 2021-09-02 15:28 菜霸 编辑
配置异常拦截处理以及与javabean字段验证的完美结合
摘要:Spring 3.2提供了强大的新注解 @ControllerAdvice,主要是用来Controller的一些公共的需求的低侵入性增强提供辅助,作用于@RequestMapping标注的方法上。 和此注解配合使用的其他注解有: @ExceptionHandler 自定义的错误处理器 @ModelA 阅读全文
posted @ 2020-04-23 15:10 菜霸 编辑
Maven打包异常:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war
摘要:出现下面异常,因为默认web.xml在 src/main/webapp 下所以才出现找不到的异常。 我的项目结构为 解决办法①: 在pom.xml里面制定 web位置即可 解决办法②(实际上都一样只是参数不同) 阅读全文
posted @ 2019-07-19 10:42 菜霸 编辑
@Autowired与@Resource 详细诠释和区别(附带例子)
摘要:@Autowired 与@Resource:1、@Autowired与@Resource都可以用来装配bean. 都可以写在字段上,或写在setter方法上。2、@Autowired默认按类型装配(这个注解是属业spring的),默认情况下必须要求依赖对象必须存在,如果要允许null值,可以设置它的 阅读全文
posted @ 2018-10-17 16:13 菜霸 编辑
Spring 配置 Annotation <context:annotation-config> 和 <context:component-scan>标签的诠释及区别
摘要:Spring 开启Annotation <context:annotation-config> 和 <context:component-scan>诠释及区别 <context:annotation-config> 和 <context:component-scan>的区别 <context:ann 阅读全文
posted @ 2018-10-17 16:05 菜霸 编辑
Spring整合mybatis
摘要:Maven配置 Maven配置依赖 Spring中配置 Mybatis。由Spring管理mybatis 直接在spring配置文件中设置Mybatis即可。 Spring-config.xml 内容如下 <?xml version="1.0" encoding="UTF-8"?> <beans x 阅读全文
posted @ 2018-08-01 11:53 菜霸 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示