Springboot整合(0)介绍+准备

Springboot整合(0)介绍+准备

开发环境

IDE:eclipse

数据库:mysql

服务器:tomcat

整合技术

web框架:springboot

ORM框架:mybatis

日志框架:log4j

测试:junit

数据库连接池:druid

缓存:redis

权限框架:shiro (shiro缓存使用ehcache)

创建工程

1. 创建一个maven工程(packaging选择war项目创建出来会有红叉,原因是web工程缺少web.xml文件)

 

 


 

2. 设置java版本为1.8(非必要,但至少要1.7以上,否则springboot有时候会运行出问题)


 

3. 在webApp目录下创建WEB-INF文件夹,并创建web.xml文件


 

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns="http://xmlns.jcp.org/xml/ns/javaee"

    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"

    id="WebApp_ID" version="3.1">

 

    <display-name>KnowledgeIsland</display-name>

 

    <filter>

        <filter-name>charsetEncoding</filter-name>

        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

        <init-param>

            <param-name>encoding</param-name>

            <param-value>UTF-8</param-value>

        </init-param>

        <init-param>

            <param-name>forceEncoding</param-name>

            <param-value>true</param-value>

        </init-param>

    </filter>

 

    <filter-mapping>

        <filter-name>charsetEncoding</filter-name>

        <url-pattern>/*</url-pattern>

    </filter-mapping>

 

 

    <session-config>

        <session-timeout>30</session-timeout>

    </session-config>

</web-app>

 

4. 至此准备工作完成,下一节开始正式整合。此处先把后面会写到的内容目录贴出来

 

目录

Springboot整合(1)——springboot基础配置

Springboot整合(2)——MyBatis整合

    1. 配置

    2. 使用mybatis-generator生成代码

    3. 测试

Springboot整合(3)——log4j

Springboot整合(4)——JUnit,事务

Springboot整合(5)——全局异常处理

Springboot整合(6)——数据校验

Springboot整合(7)——数据库连接池Druid

Springboot整合(8)——Redis

Springboot整合(9)——Shiro

    Shiro基本配置

    Shiro注解的使用

    Shiro全局异常处理

    为Shiro配置Cache

    使用Shiro的Remember Me

Springboot整合(10)——Intercepter

    为Shiro RememberMe功能提供session初始化

    记录系统日志

猜你喜欢

转载自jy03100000.iteye.com/blog/2410511