Java教程

SSM整合,字节跳动java面试题数据结构与算法

本文主要是介绍SSM整合,字节跳动java面试题数据结构与算法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

com.alibaba

druid

1.1.22

<group

《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》

【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完整内容开源分享

Id>mysql

mysql-connector-java

5.1.47

5.日志相关jar包

log4j

log4j

1.2.17

org.slf4j

slf4j-api

1.7.10

org.slf4j

slf4j-log4j12

1.7.10

6.测试相关jar包

junit

junit

4.12

test

二、配置文件


1.spring整合mybatis spring-mybatis.xml

jdbc.properties

jdbc.driverClassName=com.mysql.jdbc.Driver

jdbc.url=jdbc:mysql://localhost:3306/videos?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8

jdbc.username=root

jdbc.password=123456

initialSize=5

maxActive=20

maxWait=2000

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

<beans xmlns=“http://www.springframework.org/schema/beans”

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xmlns:context=“http://www.springframework.org/schema/context”

xmlns:tx=“http://www.springframework.org/schema/tx”

xsi:schemaLocation="

http://www.springframework.org/schema/beans

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

http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx.xsd

http://www.springframework.org/schema/context

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

<context:component-scan base-package=“com.liubo.SSMTemplate.service”/>

<context:property-placeholder location=“classpath:jdbc.properties”/>

<tx:annotation-driven transaction-manager=“transactionManager”/>

2.springMVC配置文件

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

<beans xmlns=“http://www.springframework.org/schema/beans”

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xmlns:context=“http://www.springframework.org/schema/context”

xmlns:mvc=“http://www.springframework.org/schema/mvc”

xsi:schemaLocation="

http://www.springframework.org/schema/beans

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

http://www.springframework.org/schema/context

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

http://www.springframework.org/schema/mvc

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

<context:component-scan base-package=“com.liubo.SSMTemplate.controller”/>

mvc:default-servlet-handler/

mvc:annotation-driven/

mvc:interceptors

mvc:interceptor

<mvc:mapping path="/video/*"/>

<mvc:mapping path="/speaker/*"/>

<mvc:mapping path="/course/*"/>

</mvc:interceptor>

</mvc:interceptors>

3.mybatis配置文件

mybatis-config.xml

此文件多用与配置一些在spring-mybatis文件中不方便配置的东西

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

4.web.xml 的配置

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

<web-app version=“3.0” xmlns=“http://java.sun.com/xml/ns/javaee”

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

Archetype Created Web Application

contextConfigLocation

classpath:spring-*.xml

log4jConfigLocation

classpath:log4j.properties

org.springframework.web.context.ContextLoaderListener

dispatcherServlet

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:springmvc.xml

1

dispatcherServlet

/

characterEncodingFilter

org.springframework.web.filter.CharacterEncodingFilter

encoding

UTF-8

characterEncodingFilter

/*

这篇关于SSM整合,字节跳动java面试题数据结构与算法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!