“百家拼”的spring mvc项目搭建的几步:
1.项目创建
使用intellidea和maven进行项目创建。
New Project->Maven Module->Create from archetype->选择 maven archetype webapp。详细参考:http://sauron.blog.51cto.com/5231038/1269350
2.添加依赖
maven依赖需要向pom.xml文件里面添加dependency。可以根据需要到包名到http://mvnrepository.com/去搜索,里面有写好的dependency,直接复制过来。
3.配置web.xml
配置xml文件路径(这里放到了resources/spring路径下了):
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:spring/applicationContext*.xml
</param-value>
</context-param>
其他加载:
http://zhxing.iteye.com/blog/399668
4.spring security
使用spring security进行权限验证,主要有:配置文件/数据库/LDAP。如果要结合使用,比如,使用本地数据库进行权限验证,使用LDAP进行密码验证可以参考:http://suene.iteye.com/blog/1831347 。核心是实现AuthenticationProvider接口,重写init和authenticate方法。并在xml如下配置:
<authentication-manager alias="authenticationManager">
<authentication-provider ref="authenticationProvider" />
</authentication-manager>
<b:bean id="authenticationProvider" class="com.xxx.LdapAndDbAuthenticationProvider">
<b:property name="authenticateByLdap" value="true" />
<b:property name="passwordCompar" value="true" />
<b:property name="url" value="ldap://${ldap.server.ip}:${ldap.server.port}" />
<b:property name="userSearchBase" value="DC=xxx,DC=domain" />
</b:bean>
5.数据库
使用ibitis进行映射,http://www.cnblogs.com/archie2010/archive/2011/05/06/2038792.html
6.项目部署
部署到jetty:http://hi.baidu.com/winterhome/item/713061dfde287fe5b3f777d0
7.spring标签注解
http://www.ibm.com/developerworks/cn/opensource/os-cn-spring-iocannt/
8.