List转Map
编码过程中经常会遇到需要将List转换成Map的需求
例如文章列表(List<Article>),数据库一般只保存了作者的uid,我们在批量拿到用户信息后(List<User>),需要把User对象赋值给相应的Article,
在今天之前我一直都是手工将List<User>转换成M
......[阅读全文]
public class App {
public static void main(String[] args) {
List<Apple> listApple = new ArrayList<>();
Apple apple = new Apple();
for(int i=0; i<5; i++) {
apple.setName("苹果" + i);
listApple.add(apple);
}
......[阅读全文]
Multiple annotations found at this line:
- cvc-elt.1: Cannot find the declaration of element 'beans'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-4.3.xsd', because 1) could not find the d
......[阅读全文]
新安装的ActiveMQ,在Web控制台查看消息内容,无法查看
Exception accurred while processing this request, check the log for more information!
data/activemq.log 日志里面有下面的内容:
PWC6197: An error occurred at line: 20 in the jsp file: /WEB-INF/tags/form/forEac
......[阅读全文]
1,@Value注解不能用在静态成员上
2,使用@Value注解的类所在的包需要加入到组件扫描(context:component-scan)
3,使用@Value注解的类需要是 @Service,@Component,@Repository,@Controller 等注解才能被组件扫描到
4,在实例化包含@VAlue注解的类时,需要用 @Autowired
......[阅读全文]
ActiveMQ在SpringMVC下配置和应用
ActiveMQ下载地址
http://activemq.apache.org/download-archives.html
解压,启动
./bin/activemq start
访问Web控制台
默认用户名和密码:admin:admin
http://192.168.9.10:8161/
设置Web控制台用户名和密码
vim ./conf/u
......[阅读全文]
感觉SpringMVC里面比较常用的分页插件MyBatis-PageHelper太大太复杂,于是自己写了一个简单易用的
https://github.com/jomch/Pagination
1,下载kaptcha
https://code.google.com/archive/p/kaptcha/downloads
2,导入到Maven仓库
mvn install:install-file -Dfile=c:/kaptcha-2.3.2.jar -DgroupId=com.google.code.kaptcha -DartifactId=kaptcha -Dversion=2.3.2 -Dpackaging=jar
3,配置pom.xml依
......[阅读全文]
今天在调试Spring代码的时候报这个错误,页面404
严重: Error configuring application listener of class [org.springframework.web.context.ContextLoaderListener]
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apac
......[阅读全文]