随笔分类 - spring
摘要:首先@Component和@Bean都可以注册Bean。 区别在于: @Component放在类上,表示这个类是组件类,Spring要为这个类创建bean。@Component 和@Repository , @ Controller , @Service一样,局限于自己编写的类中. @Bean放在方
阅读全文
摘要:目录 一、IoC配置 1、bean标签介绍 2、bean的实例化 二、DI配置 1、依赖注入的方式 2、不同属性依赖注入 回到顶部 一、IoC配置 IoC的配置是通过Spring的xml文件的bean标签进行的。 1、bean标签介绍 bean标签一般是在xml文件进行配置的,xml文件一般样式如下
阅读全文
摘要:// TableField annotation = f.getAnnotation(TableField.class); // 不建议使用这个,建议使用下面这个方法获取 TableField annotation = AnnotationUtils.getAnnotation(f, TableFi
阅读全文
摘要:文件上传时,tomcat报错org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException
阅读全文
摘要:在Spring框架里面,可以通过以下几种方式获取到当前登录用户的详细信息: 1. 在Bean中获取用户信息 Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (!(au
阅读全文
摘要:application.yml中加上 # springBoot+Mybatis 控制台打印SQL语句 (方式一) logging: level: com.zoctan.api.mapper : debug # 配置slq打印日志 (方式二) mybatis-plus: configuration:
阅读全文
摘要:1.在pom.xml下添加Junit依赖: <!--添加junit环境的jar包--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId>
阅读全文

浙公网安备 33010602011771号