25
2020
05

@webappconfiguration注解

 

  • Spring @WebAppConfiguration Annotation Example

25
2020
05

SpringMVC@ContextConfiguration注解详解

 

@ContextConfiguration这个注解通常与@RunWith(SpringJUnit4ClassRunner.class)联合使用用来测试

当一个类添加了注解@Component,那么他就自动变成了一个bean,就不需要再Spring配置文件中显示的配置了。把这些bean收集起来通常有两种方式,Java的方式和XML的方式。当这些bean收集起来之后,当我们想要在某个测试类使用@Autowired注解来引入这些收集起来的bean时,只需要给这个测试类添加@ContextConfiguration注解来标注我们想要导入这个测试类的某些bean。

25
2020
05

org.apache.ibatis.type.TypeException: Could not resolve type alias 'WithDeptResultMap'

 Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'WithDeptResultMap'.  Cause: java.lang.ClassNotFoundException: Cannot find class: WithDeptResultMap
 at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:100)
 at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:69)
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:132)
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:125)
 at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:115)
 ... 44 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'WithDeptResultMap'.  Cause: java.lang.ClassNotFoundException: Cannot find class: WithDeptResultMap
 at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:114)
 at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:127)
 at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:98)
 ... 48 more
Caused by: java.lang.ClassNotFoundException: Cannot find class: WithDeptResultMap
 at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:188)
 at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:87)
 at org.apache.ibatis.io.Resources.classForName(Resources.java:254)
 at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:110)
 ... 50 more

25
2020
05

log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUn

SSM整合,在进行单元测试时,会报下面的警告。

log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUnit4ClassRunner).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

25
2020
05

Establishing SSL connection 问题,解决方案

  WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

25
2020
05

wpf2019激活码

WPS Office 2019 专业增强激活码版,系某地政府采购,大家在安装完WPS之后,手动输入序列号即可激活。安全可靠,用户首选。

23
2020
05

MBG配置自动生成bean,dao,mapper

 MBG配置文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <context id="DB2Tables" targetRuntime="MyBatis3">
        <commentGenerator>
            <property name="suppressAllComments" value="true" />
        </commentGenerator>
        <!-- 配置数据库连接 -->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://localhost:3306/test?useUnicode=true&amp;ampcharacterEncoding=utf-8&amp;useSSL=false" userId="root"
                        password="Zckj@118">
        </jdbcConnection>
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>
        <!-- 指定javaBean生成的位置 -->
        <javaModelGenerator targetPackage="com.zckj.beans"
                            targetProject=".\src\main\java">
            <property name="enableSubPackages" value="true" />
            <property name="trimStrings" value="true" />
        </javaModelGenerator>
        <!--指定sql映射文件生成的位置 -->
        <sqlMapGenerator targetPackage="mapper" targetProject=".\src\main\resources">
            <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>
        <!-- 指定dao接口生成的位置,mapper接口 -->
        <javaClientGenerator type="XMLMAPPER"
                             targetPackage="com.zckj.dao" targetProject=".\src\main\java">
            <property name="enableSubPackages" value="true" />
        </javaClientGenerator>

        <!-- table指定每个表的生成策略 -->
        <table tableName="t_emp" domainObjectName="Employee"></table>
        <table tableName="t_dept" domainObjectName="Department"></table>
    </context>
</generatorConfiguration>

调用 生成代码事件:

23
2020
05

Establishing SSL connection without server's identity verification is not recommended.

java连接mysql数据库运行,出现以下警告:

 Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

23
2020
05

SSM框架 HttpPutFormContentFilter 过期解决方法

HttpPutFormContentFilter过滤器会自动的封装前台传递过来的PUT请求的参数,如果不配置HttpPutFormContentFilter过滤器的话,那么tomcat便不会自主的分封装PUT请求的参数。

<filter>
  <filter-name>
HttpPutFormContentFilter
</filter-name>
  <filter-class>
org.springframework.web.filter.HttpPutFormContentFilter
</filter-class>
</filter>
<filter-mapping>
  <filter-name>
HttpPutFormContentFilter
</filter-name>
  <url-pattern>
/*
</url-pattern>
</filter-mapping>

但现在官方已经不再推荐使用该配置。

22
2020
05

SpringMVC ContentNegotiatingViewResolver详解

 

  1. ContentNegotiatingViewResolver,这个视图解析器允许你用同样的内容数据来呈现不同的view。它支持如下面描述的三种方式: