ssm框架搭建详细步骤_SSM博客系统框架搭建篇

今天一起来把之前文章提到的博客系统的框架结构搭建出来。想做这个项目的自己动手练练。

这个项目用mavan来管理的,新建一个maven项目。建好以后会生生一个pom.xml文件,先从它开始配置。

2c8b230f68e5b3c2e886d58f821bb9cc.png

一:【pom.xml配置】在此标签加入如下配置;集成springmvc,spring,mybatis的配置与jar包加载。另外还有就是项目中所有用到的其他集成框架的配置。

 javax.servletjavax.servlet-api3.1.0javax.servlet.jspjavax.servlet.jsp-api2.3.1javax.servletjstl1.2org.springframework spring-core 4.1.7.RELEASEorg.springframework spring-beans 4.1.7.RELEASEorg.springframework spring-tx 4.1.7.RELEASEorg.springframework spring-context 4.1.7.RELEASEorg.springframework spring-context-support 4.1.7.RELEASEorg.springframeworkspring-web4.1.7.RELEASEorg.springframeworkspring-webmvc4.1.7.RELEASEorg.springframeworkspring-aop4.1.7.RELEASEorg.springframeworkspring-aspects4.1.7.RELEASEorg.springframeworkspring-jdbc4.1.7.RELEASEorg.mybatismybatis-spring1.2.3log4jlog4j1.2.17org.slf4jslf4j-log4j121.7.12org.mybatismybatis3.3.0mysqlmysql-connector-java5.1.37org.apache.shiroshiro-core1.2.4org.apache.shiroshiro-web1.2.4org.apache.shiroshiro-spring1.2.4commons-fileuploadcommons-fileupload1.3.1commons-codeccommons-codec1.10commons-langcommons-lang2.5commons-beanutilscommons-beanutils1.8.0commons-collectionscommons-collections3.2.1commons-loggingcommons-logging1.1.1net.sf.ezmorphezmorph1.0.6org.apache.lucenelucene-core5.3.1org.apache.lucenelucene-analyzers-common5.3.1org.apache.lucenelucene-analyzers-smartcn5.3.1org.apache.lucenelucene-queryparser5.3.1org.apache.lucenelucene-highlighter5.3.1com.alibabadruid1.0.16
f0a8259db378bf33cc4eed8679fdc675.png

二:【springmvc进行配置】

配置spring-mvc.xml;

 

三:【spring配置】

配置:applicationContext.xml;

 /login=anon/admin/**=authc 
5791fc5765f9970fc2d44c1264a3d529.png

四:【mybatis配置】

配置mybatis-config.xml;

这里我就是把实体都映射到这里了,就不需要加乱七八糟的前缀了。直接用类名就行了。

五:封包:

创建用户实体类:

创建实体类Dao层接口;具体实现交给mybatis;

然后就开始进行创建并配置BloggerMapper.xml;

 这里我就主要定义了一个结果集,后续自己开发时候select,delete等等就在这里面进行定义。

创建service层:

主要是事物层的逻辑实现。和dao层一样,创建service层接口以及它的实现类;

直接用注解方式:@Service("bloggerService");

在进行创建controller层;用于访问前台页面;

@Controller@RequestMapping("/blogger")//映射路径public class BloggerController {@Resourceprivate BloggerService bloggerService;//注入}

六:【自定义realm】

这个设计就是,验证当前登录的用户;

* 验证当前登录的用户

*/

@Overrideprotected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {// TODO Auto-generated method stubreturn null;}}

七:【web.xml配置】

 index.jspshiroFilterorg.springframework.web.filter.DelegatingFilterProxytargetFilterLifecycletrueshiroFilter/*contextConfigLocationclasspath:applicationContext.xmlencodingFilterorg.springframework.web.filter.CharacterEncodingFiltertrueencodingUTF-8encodingFilter/*org.springframework.web.context.ContextLoaderListenerspringMVCorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring-mvc.xml1truespringMVC*.dospringMVC*.html
6ba5bd435bcc35655d32e2edbeb4ce22.png

ok;随便写个jsp发布请求一下,这个框架就完事;大家好好配置练习一下;

有不懂和疑问随时问我;

项目jar包获取方法:点赞+关注+私信问我要就行了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值