eclipse
eclipse
我要变胖哇
开心,简单
展开
-
SpringBoot实践:使用@Validated相关异常
在使用Spring Boot集成@Validated验证的时候,报出如下错误javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint ‘org.hibernate.validator.constraints.NotBlank’ validating type ‘java.lang.Integer’. Check configuration for ‘displayType’原创 2020-12-23 20:11:58 · 901 阅读 · 0 评论 -
@Resource与@Autowired用法区别(详细)
spring中,@Resource和@Autowired都是做bean的注入时使用。使用过程中,有时候@Resource 和 @Autowired可以替换使用;有时,则不可以。下面,根据自己的学习,整理下这两个注解使用中的共同点和不同点,及用法上的不同。共同点@Resource和@Autowired都可以作为注入属性的修饰,在接口仅有单一实现类时,两个注解的修饰效果相同,可以互相替换,不影响使用。不同点@Resource是Java自己的注解,@Resource有两个属性是比较重要的,分是name和原创 2020-12-08 17:16:59 · 4313 阅读 · 0 评论 -
Mybatis与spring获取对象不同点
从XML中构建SqlSessionFactory每个基于Mybatis的应用都是以一个SqlSessionFactory的实例为核心的。SqlSessionFactory的实例如何通过SqlSessionFactoryBuilder获得,而SqlSessionfactoryBuilder则可以从XML配置文件或一个预先配置的Configuration实例来构建出SqlSessionFactory实例。从XML文件中构建SqlSessionFactory的实例非常简单,建议使用类路径下的资源文件进行配置。原创 2020-12-06 20:05:36 · 116 阅读 · 0 评论 -
Spring的三种注入方式:构造方法注入,set方法注入,注解注入
本文演示三种值注入方式和三层模式下的注解注入获取对象首先是搭建基本的Spring运行环境导入四个基本的核心jar包和两个日志包在src根目录下新建bean.xml的配置文件,同时引入dtd约束一、构造函数注入在bean.xml中配置在测试类中测试是否成功获得对象实例,并注入数据运行结果图:二、set方法注入首先在类中必须有成员属性的set方法接着在bean.xml中配置,使用的是property标签测试类:运行结果:我们一般使用set方法注入,因为它不会改变类的构原创 2020-12-06 19:59:17 · 6599 阅读 · 0 评论 -
spring的基础总结
1.pom的文件需要5个(1)spring-core(2)spring-context(3)spring-beans(4)spring-expression(5)commons-logging2.定义有参数的构造方法时候,要加一个无参的构造方法3.测试类里面获取配置文件的信息ApplicationContext applicationContext=new ClassPathXmlApplicationContext("application-context.xml");两种方式获取配原创 2020-12-06 19:52:14 · 145 阅读 · 0 评论 -
mybaties总结
1.需要导入四个坐标分别是mybatits、junit、log4j、mysql-connection-java2.连接数据库信息、配置mapper的位置3.映射文件namespace对应的是接口全名、id是接口里面的方法名、resultType是类的全名4.创建测试类的时候(1)SqlSessionFactoryBuilder通过初始方法从xml文件获取到sqlSessionFactory(2)sqlSessionFactory通过openSession()方法来获取到sqlSession对象原创 2020-12-04 18:40:59 · 164 阅读 · 0 评论 -
mybaties中resultMap和resultType的区别
总结基本映射 :(resultType)使用resultType进行输出映射,只有查询出来的列名和pojo中的属性名一致,该列才可以映射成功。(数据库,实体,查询字段,这些全部都得一一对应)高级映射 :(resultMap) 如果查询出来的列名和pojo的属性名不一致,通过定义一个resultMap对列名和pojo属性名之间作一个映射关系。(高级映射,字段名称可以不一致,通过映射来实现resultType和resultMap功能类似 ,都是返回对象信息 ,但是resultMap要更强大一些 ,可自定义。原创 2020-12-04 18:36:34 · 221 阅读 · 0 评论 -
idea在maven中导入jstl无效解决办法
首先在pom中添加依赖 <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>taglibs<原创 2020-12-01 17:57:37 · 858 阅读 · 0 评论 -
ContextLoaderListener的作用
1. 概述在web应用启动的,ContextLoaderListener读取contextConfigLocation中定义的xml文件,自动装配ApplicationContext的配置信息,并产生WebApplicationContext对象,然后将这个对象放置在ServletContext的属性里,这样我们就可以在servlet里得到WebApplicationContext对象。2. 源码分析ContextLoaderListener继承关系public class ContextLoade原创 2020-12-01 16:15:47 · 254 阅读 · 0 评论 -
报错:Dependency annotations: {@org.springframework.beans.fact}
这两天自己搭spingmvc,总是报错,找不到自动注册的beanCould not autowire field: private lf.service.UserService lf.controllers.UserController.userService;nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type [lf.service原创 2020-12-01 16:05:20 · 4453 阅读 · 2 评论 -
Error:Cannot build artifact xxx:war exploded‘ because it is included into a circular dependency
IDEA 项目报错:Error:Cannot build artifact xxx:war exploded’ because it is included into a circular dependency解决:ctrl + alt + shift + s 打开 project structure (或者ctrl alt + a 搜索 project structure)点左边artifacts,删掉多余的两个,分别是xxx:warxxx:war exploded删掉就好了。...原创 2020-11-30 17:46:01 · 1911 阅读 · 2 评论 -
Unused import statement解决方法
前言: 一直都能运行的项目,不知道怎么回事就突然报了这个问题问题截图:问题原因: maven导入的项目的pom文件出了问题问题解决: 在IDEA中找到pom文件右击-找到Git-Revert小结:后来仔细想了一下,可能是在点击时不小心将pom文件进行了修改,导致不能正常识别jar包导入地址。虽然是自己粗心而为,但是也提升了一下解决问题的思路。发现根源,解决问题才会高效!...原创 2020-11-30 17:44:17 · 5606 阅读 · 0 评论 -
applicationcontext in module file is included in 5 contexts的解决方式
有时候IDEA会出现这样的情况:明明敲得挺好的代码却莫名其妙的出现这个错误然后自己这个错误出现几次了,所以我要把它记录下来。让我们把他解决吧1.file------project Structure2.Modules------Spring先把所有的.xml文件移除3.导入自己需要的.xml文件4.然后就ok啦。恭喜你把错误解决了,继续码代码吧!...原创 2020-11-29 22:40:14 · 478 阅读 · 0 评论 -
Maven项目导入jstl注意事项
使用<c:forEach></c:forEach>标签,提示Unknown tag (c:forEach).jsp顶端写入标签<%@ taglib uri=“http://java.sun.com/jsp/jstl/core” prefix=“c” %>提示:Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"因为缺少相关包添加jar包时原先正常的包报了大批原创 2020-11-29 22:38:20 · 393 阅读 · 0 评论 -
Maven 中启动 Tomcat,控制台和日志打印信息出现乱码的解决方法
找到intellij idea 的 file—settings—Editor—FileEncodings的GlobalEncoding和ProjectEncoding和Default encoding for properties都配置成UTF-8步骤2:找到自己的IDEA目录IDEA\IntelliJ IDEA xxx\bin,编辑器打开文件,然后末行追加上 -Dfile.encoding=UTF-8 这是保证catalina Log里面不输出乱码步骤3:在 tomcat 的安装目录下,进入c原创 2020-11-29 22:37:20 · 231 阅读 · 0 评论 -
通过JavaAPI访问HBase
先开始创建表create 'emp001','member_id','address','info'放入数据put 'emp001','Rain','id','31'put 'emp001', 'Rain', 'info:birthday', '1990-05-01'put 'emp001', 'Rain', 'info:industry', 'architect'put 'emp001', 'Rain', 'info:city', 'ShenZhen'put 'emp001', 'Rain原创 2020-11-21 23:33:31 · 706 阅读 · 0 评论 -
Eclipse:The selection cannot be launched,and there are no recent launches
报错:Eclipse工具启动提示the selection cannot be launched,and there are no recent经网上查找了解,缺少String []args,好久没学java了暴露了,修改后run错误代码public class Student { public static void main() { String name="liuzr"; System.out.println(name); } 正确代码应该加String []args就可以原创 2020-11-21 23:02:43 · 759 阅读 · 0 评论 -
Operator ‘+‘ cannot be applied to ‘java.lang.String‘, ‘void‘的解决方法
刚开始报下图错,是因为我在另一个类中定义有返回值void的方法,如图二一个想要调用另一个的方法,且是字符串的类型的需要将void换成string,并将输出语句换成return。如图:记得最后一行的分号去掉。...原创 2020-11-06 19:35:33 · 14296 阅读 · 1 评论 -
The content of element type “web-app“ must match “(icon?,display-name?,description?,报错解决方案
在web.xml文件配置时报如下错误:The content of element type “web-app” must match “(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page原创 2020-11-05 19:45:24 · 516 阅读 · 0 评论 -
无法找到元素 ‘aop:aspectj-autoproxy‘ 的声明
一一对应看看是不是哪个没写或者写错了idea自动导包有时候导包导的不全。后来通过查询文档发现,我们不仅仅要引入Aop的名称空间,还要在xsi:schemaLocation中加入aop的xsd文件http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd这两个是必须要有的,缺一不可由此可以看出,在使用Spring Aop时,不仅需要引入Aop的名称空间,还有引入.原创 2020-10-10 15:48:38 · 446 阅读 · 1 评论 -
报错:IOException parsing XML document from class path resource [applicationContext.xml]; nested except
1.出现IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist上面这张图是我的目录,它一直说找不到applicatio原创 2020-10-10 14:17:02 · 13989 阅读 · 6 评论 -
eclipse内置服务器打不开 但是外置服务器能打开的问题
我实力吐槽这个内置服务器,折磨我一学期,现在终于好了,内置服务器打不开的原因就是是因为我没有把代理服务器关掉下面是内置服务器的详解我用#CSDN#这个app发现了有技术含量的博客,小伙伴们求同去《eclipse内置浏览器访问本地http://127.0.0.1:8080不能正常显示》, 一起来围观吧 https://blog.csdn.net/weixin_41217840/article/d...原创 2020-02-09 14:34:54 · 899 阅读 · 1 评论