KevinZeng的博客

Learn and live & Knowledge is power.


  • 首页

  • 归档

  • 分类

  • 标签

  • java

  • Hexo

  • 关于

Spring MVC – Beans loaded twice

发表于 2016-04-14   |   分类于 spring   |  

A Spring MVC web application, noticed all the Spring’s beans are loaded twice!?

1
2
3
4
5
6
7
8
9
10
11
12
package com.mkyong.config.db;

@Configuration
publicclass MongoDevConfig {
private final static Logger logger = LoggerFactory.getLogger(MongoDevConfig.class);

@Bean
MongoDbFactory mongoDbFactory()throws Exception {
//...returnnew new SimpleMongoDbFactory(mongo,"db");;
logger.debug("Init...... MongoDbFactory() in production mode!");
}
}

During Application startup :

1
2
2015-03-0517:52:32 DEBUG c.m.config.MongoLiveConfig- Init...... MongoDbFactory()in production mode!
2015-03-0517:52:32 DEBUG c.m.config.MongoLiveConfig - Init...... MongoDbFactory()in production mode!

1. Spring Configuration

Here is the Spring MVC configuration.

web.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<web-app>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
</web-app>

mvc-dispatcher-servlet.xml
1
2
3
<beans...>
<context:component-scan base-package="com.springmvc"/><mvc:annotation-driven />
</beans>
阅读全文 »

quartz-cronExpression

发表于 2016-03-29   |   分类于 Quartz   |  

CronTrigger配置格式

格式: [秒] [分] [小时] [日] [月] [周] [年]

阅读全文 »

JQueryQ Validate

发表于 2016-03-28   |   分类于 Jquery Validate   |  

默认校验规则

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
required:true               必输字段
remote:"remote-valid.jsp" 使用ajax方法调用remote-valid.jsp验证输入值
email:true 必须输入正确格式的电子邮件
url:true 必须输入正确格式的网址
date:true 必须输入正确格式的日期,日期校验ie6出错,慎用
dateISO:true 必须输入正确格式的日期(ISO),例如:2009-06-23,1998/01/22 只验证格式,不验证有效性
number:true 必须输入合法的数字(负数,小数)
digits:true 必须输入整数
creditcard:true 必须输入合法的信用卡号
equalTo:"#password" 输入值必须和#password相同
accept: 输入拥有合法后缀名的字符串(上传文件的后缀)
maxlength:5 输入长度最多是5的字符串(汉字算一个字符)
minlength:10 输入长度最小是10的字符串(汉字算一个字符)
rangelength:[5,10] 输入长度必须介于 5 和 10 之间的字符串")(汉字算一个字符)
range:[5,10] 输入值必须介于 5 和 10 之间
max:5 输入值不能大于5
min:10 输入值不能小于10

默认提示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
messages: {
required: "This field is required.",
remote: "Please fix this field.",
email: "Please enter a valid email address.",
url: "Please enter a valid URL.",
date: "Please enter a valid date.",
dateISO: "Please enter a valid date (ISO).",
dateDE: "Bitte geben Sie ein g眉ltiges Datum ein.",
number: "Please enter a valid number.",
numberDE: "Bitte geben Sie eine Nummer ein.",
digits: "Please enter only digits",
creditcard: "Please enter a valid credit card number.",
equalTo: "Please enter the same value again.",
accept: "Please enter a value with a valid extension.",
maxlength: $.validator.format("Please enter no more than {0} characters."),
minlength: $.validator.format("Please enter at least {0} characters."),
rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
range: $.validator.format("Please enter a value between {0} and {1}."),
max: $.validator.format("Please enter a value less than or equal to {0}."),
min: $.validator.format("Please enter a value greater than or equal to {0}.")
}
阅读全文 »

Hexo Quick Start

发表于 2016-03-25   |   分类于 hexo   |  

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

阅读全文 »

java

发表于 2016-03-24   |   分类于 -java   |  

My New Post

发表于 2016-03-23   |   分类于 Test , 测试   |  

Hexo Quick Start

发表于 2016-03-23   |   分类于 hexo   |  

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

阅读全文 »
PhoenixTea

PhoenixTea

Knowledge is power

7 日志
7 分类
11 标签
RSS
Github Weibo Email
友情链接
  • 淘宝
  • 微店
© 2016 PhoenixTea
由 Hexo 强力驱动
主题 - NexT.Mist