LibrarySystem图书管理系统(二)

网友投稿 232 2023-01-31


LibrarySystem图书管理系统(二)

本文实例为大家分享了LibrarySystem图书管理系统第二篇,供大家参考,具体内容如下

第一步:添加数据库配置文件

jdbc.properties

# 数据库驱动

jdbc.driver=com.mysql.jdbc.Driver

# 数据库地址

jdbc.url=jdbc:mysql://localhost:3306/library?useUnicode=true&characterEncoding=UTF-8

# 用户名

jdbc.username=root

# 密码

jdbc.password=root

# 初始化连接

initialSize=0

# 最大连接数量

maxActive=20

# 最大空闲连接

maxIdle=20

# 最小空闲连接

minIdle=1

# 超时等待时间

maxWait=60000

第二步:添加mybatis配置文件

mybatis-config.xml

第三步:添加Spring配置文件

在resources/spring目录下新建二个文件:

│   └── spring

│       ├── spring-mybatis.xml

│       ├── spring-service.xml

│       └── spring-mvc.xml

spring-mvc.xml

xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:p="http://springframework.org/schema/p"

xmlns:context="http://spriyDkIJMuXngframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans-4.0.xsd

http://springframework.org/schema/context

http://springframework.org/schema/context/spring-context-4.0.xsd

http://springframework.org/schema/mvc

http://springframework.org/schema/mvc/spring-mvc-4.0.xsd">

text/plain;charset=UTF-8

text/html;charset=UTF-8

application/json;charset=UTF-8

xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:p="http://springframework.org/schema/p"

xmlns:context="http://spriyDkIJMuXngframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans-4.0.xsd

http://springframework.org/schema/context

http://springframework.org/schema/context/spring-context-4.0.xsd

http://springframework.org/schema/mvc

http://springframework.org/schema/mvc/spring-mvc-4.0.xsd">

text/plain;charset=UTF-8

text/html;charset=UTF-8

application/json;charset=UTF-8

spring-mybatis.xml

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context" xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans-3.1.xsd

http://springframework.org/schema/context

http://springframework.org/schema/context/spring-context-3.1.xsd

http://springframework.org/schema/tx

http://springframework.org/schema/tx/spring-tx.xsd">

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context" xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans-3.1.xsd

http://springframework.org/schema/context

http://springframework.org/schema/context/spring-context-3.1.xsd

http://springframework.org/schema/tx

http://springframework.org/schema/tx/spring-tx.xsd">

spring-service.xml

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context

http://springframework.org/schema/context/spring-context.xsd

http://springframework.org/schema/tx

http://springframework.org/schema/tx/spring-tx.xsd">

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context

http://springframework.org/schema/context/spring-context.xsd

http://springframework.org/schema/tx

http://springframework.org/schema/tx/spring-tx.xsd">

第四步:添加logback配置文件

logback配置比log4j要简单点,功能类似

├── resources

│   ├── logback.xml

在resources文件夹下新建文件:logback.xml

%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n

第五步:配置web.xml

web.xml

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

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

version="3.1" metadata-complete="true">

Archetype Created Web Application

seckill-dispatcher

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:spring/spring-*.xml

1

true

seckill-dispatcher

/

CharacterEncodingFilter

org.springframework.web.filter.CharacterEncodingFilter

encoding

UTF-8

CharacterEncodingFilter

/*

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

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

version="3.1" metadata-complete="true">

Archetype Created Web Application

seckill-dispatcher

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:spring/spring-*.xml

1

true

seckill-dispatcher

/

CharacterEncodingFilter

org.springframework.web.filter.CharacterEncodingFilter

encoding

UTF-8

CharacterEncodingFilter

/*

项目结构:


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Android接入微信支付的方法
下一篇:使用proxytable 配置解决 vue
相关文章

 发表评论

暂时没有评论,来抢沙发吧~