struts2.3.20+spring4.0.2+hibernate4.3.4框架整合
一、创建web工程,搭建Struts框架开发环境:
- 步骤1::导入struts框架所需的jar包
- 步骤2:在web.xml中配置struts2.0主过滤器
- 步骤3:导入struts.xml配置文件
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app version="2.5" 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_2_5.xsd">
- <!-- 配置Struts2的主过滤器 -->
- <filter>
- <filter-name>struts2</filter-name>
- <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>struts2</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
- </web-app>
struts.xml
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
- "http://struts.apache.org/dtds/struts-2.3.dtd">
- <struts>
- <!-- 配置为开发模式 -->
- <constant name="struts.devMode" value="true" />
- <!-- 配置扩展名为action -->
- <constant name="struts.action.extension" value="action"/>
- <package name="default" namespace="/" extends="struts-default">
- </package>
- </struts>
二、搭建Hibernate开发环境:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
- <hibernate-configuration>
- <session-factory>
- <!-- 配置Hibernate:属性配置参考 Hibernate发型包\project\etc\hibernate.properties -->
- <!-- JDBC的基本链接 -->
- <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
- <property name="connection.username">root</property>
- <property name="connection.password">root</property>
- <property name="connection.url">jdbc:mysql://localhost:3306/xbmuoa</property>
- <!-- 配置数据库方言 -->
- <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
- <!-- 根据映射产生表结构的类型:
- create-drop:木有表结构创建,下次启动时删除重新创建。适合学习阶段
- create:只做创建
- update:探测表结构够的变化,对于数据库没有的,进行更新操作。适合学习阶段
- validate:对比与数据库的结构
- -->
- <property name="hibernate.hbm2ddl.auto">update</property>
- <!-- 显示sql语句及格式:开发调试阶段非常有用 -->
- <property name="hibernate.show_sql">true</property>
- <property name="hibernate.format_sql">true</property>
- <!-- 告知映射文件 -->
- </session-factory>
- </hibernate-configuration>
Person.hbm.xml(暂时性先写个映射文件的模板)
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
- <hibernate-mapping package="cn.xbmu.oa.domain">
- </hibernate-mapping>
三、搭建Spring开发环境:
- <?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-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
- <!-- 自动扫描与装配bean -->
- <context:component-scan base-package="cn.xbmu.oa"></context:component-scan>
- </beans>
以上已经将Struts、Spring、Hibernate开发所需要的jar包及其配置文件已经配置到web工程中了。
四、Spring与Hibernate整合:
- <?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-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
- <!-- 自动扫描与装配bean -->
- <context:component-scan base-package="cn.xbmu.oa"></context:component-scan>
- <!-- 加载外部的properties配置文件 -->
- <context:property-placeholder location="classpath:jdbc.properties" />
- <!-- 配置数据库连接池(c3p0) -->
- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
- <!-- 基本信息 -->
- <property name="jdbcUrl" value="${jdbcUrl}"></property>
- <property name="driverClass" value="${driverClass}"></property>
- <property name="user" value="${username}"></property>
- <property name="password" value="${password}"></property>
- <!-- 其他配置 -->
- <!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
- <property name="initialPoolSize" value="3"></property>
- <!--连接池中保留的最小连接数。Default: 3 -->
- <property name="minPoolSize" value="3"></property>
- <!--连接池中保留的最大连接数。Default: 15 -->
- <property name="maxPoolSize" value="5"></property>
- <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
- <property name="acquireIncrement" value="3"></property>
- <!-- 控制数据源内加载的PreparedStatements数量。如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0 -->
- <property name="maxStatements" value="8"></property>
- <!-- maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 -->
- <property name="maxStatementsPerConnection" value="5"></property>
- <!--最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
- <property name="maxIdleTime" value="1800"></property>
- </bean>
- <!-- 配置SessionFactory -->
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"></property>
- <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
- </bean>
- <!-- 配置声明式的事务管理(采用基于注解的方式) -->
- <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <tx:annotation-driven transaction-manager="transactionManager" />
- </beans>
jdbc.properties
- jdbcUrl = jdbc:mysql:///xbmuoa
- driverClass = com.mysql.jdbc.Driver
- username = root
- password = root
SpringTest.java
- package cn.xbmu.oa.test;
- import org.hibernate.SessionFactory;
- import org.junit.Test;
- import org.springframework.context.ApplicationContext;
- import org.springframework.context.support.ClassPathXmlApplicationContext;
- public class SpringTest {
- private ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
- //测试SessionFactory
- @Test
- public void testSessionFactory(){
- SessionFactory sessionFactory = (SessionFactory) ac.getBean("sessionFactory");
- System.out.println(sessionFactory);
- }
- }
使用Junit测试,结果:
- package cn.xbmu.oa.domain;
- public class User {
- private Long id;
- private String name;
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- }
User.hbm.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
- <hibernate-mapping package="cn.xbmu.oa.domain">
- <class name="User">
- <id name="id">
- <generator class="native"/>
- </id>
- <property name="name"/>
- </class>
- </hibernate-mapping>
- package cn.xbmu.oa.test;
- import javax.annotation.Resource;
- import org.hibernate.SessionFactory;
- import org.hibernate.classic.Session;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import cn.xbmu.oa.domain.User;
- @Service("testService")
- public class TestService {
- @Resource
- private SessionFactory sessionFactory;
- @Transactional
- public void saveTwoUser(){
- Session currentSession = sessionFactory.getCurrentSession();
- currentSession.save(new User());
- int i = 1 / 0;//这里会抛出异常
- currentSession.save(new User());
- }
- }
SpringTest.java
- package cn.xbmu.oa.test;
- import org.hibernate.SessionFactory;
- import org.junit.Test;
- import org.springframework.context.ApplicationContext;
- import org.springframework.context.support.ClassPathXmlApplicationContext;
- public class SpringTest {
- private ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
- //测试SessionFactory
- @Test
- public void testSessionFactory(){
- SessionFactory sessionFactory = (SessionFactory) ac.getBean("sessionFactory");
- System.out.println(sessionFactory);
- }
- //测试事务
- @Test
- public void testTransaction(){
- TestService testService = (TestService) ac.getBean("testService");
- testService.saveTwoUser();
- }
- }
测试事务,报错,因为在 int i = 1 / 0这里发生了异常。
查询数据库xbmuoa中的表,没有数据
五、Spring与Struts整合:
整合之前:
- package cn.xbmu.oa.test;
- import com.opensymphony.xwork2.ActionSupport;
- public class TestAction extends ActionSupport {
- @Override
- public String execute() throws Exception {
- System.out.println("---------->TestAction execute()");
- return "success";
- }
- }
struts.xml
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
- "http://struts.apache.org/dtds/struts-2.3.dtd">
- <struts>
- <!-- 配置为开发模式 -->
- <constant name="struts.devMode" value="true" />
- <!-- 配置扩展名为action -->
- <constant name="struts.action.extension" value="action"/>
- <package name="default" namespace="/" extends="struts-default">
- <!-- 测试用的action -->
- <action name="test" class="cn.xbmu.oa.test.TestAction">
- <result name="success">/test.jsp</result>
- </action>
- </package>
- </struts>
test.jsp
- <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- </head>
- <body>
- Struts2.0添加成功<br/>
- </body>
- </html>
运行:
整合之后:
- package cn.xbmu.oa.test;
- import org.springframework.context.annotation.Scope;
- import org.springframework.stereotype.Controller;
- import com.opensymphony.xwork2.ActionSupport;
- @Controller
- @Scope("prototype")
- public class TestAction extends ActionSupport {
- @Override
- public String execute() throws Exception {
- System.out.println("---------->TestAction execute()");
- return "success";
- }
- }
struts.xml
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
- "http://struts.apache.org/dtds/struts-2.3.dtd">
- <struts>
- <!-- 配置为开发模式 -->
- <constant name="struts.devMode" value="true" />
- <!-- 配置扩展名为action -->
- <constant name="struts.action.extension" value="action"/>
- <package name="default" namespace="/" extends="struts-default">
- <!-- 测试用的action,当与Spring整合后,class属性写的就是bean的名称-->
- <action name="test" class="testAction">
- <result name="success">/test.jsp</result>
- </action>
- </package>
- </struts>
在浏览器上运行:http://localhost:8080/xbmuoa/test.action
- 严重: ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
- Looks like the Spring listener was not configured for your web app!
- Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
- You might need to add the following to web.xml:
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- 四月 03, 2016 9:48:27 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
- 严重: Dispatcher initialization failed
- java.lang.NullPointerException
- at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:490)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:446)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
- at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
- at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
- at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
- at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
- at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
- at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
- at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
- at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
- at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
- at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
- at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
- at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5542)
- at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
- at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
- at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
- at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
- at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245)
- at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895)
- at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
- at java.util.concurrent.FutureTask.run(FutureTask.java:262)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
- at java.lang.Thread.run(Thread.java:724)
- 四月 03, 2016 9:48:27 下午 org.apache.catalina.core.StandardContext filterStart
- 严重: Exception starting filter struts2
- Class: com.opensymphony.xwork2.spring.SpringObjectFactory
- File: SpringObjectFactory.java
- Method: getClassInstance
- Line: 209 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1
- at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
- at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
- at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
- at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
- at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
- at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
- at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
- at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5542)
- at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
- at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
- at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
- at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
- at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245)
- at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895)
- at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
- at java.util.concurrent.FutureTask.run(FutureTask.java:262)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
- at java.lang.Thread.run(Thread.java:724)
- Caused by: java.lang.NullPointerException
- at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:490)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:446)
- at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
- at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
- at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
- at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
- at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
- at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
- ... 18 more
意思就是,没有和web工程整合,没有一个全局的工厂容器对象。
web.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app version="2.5" 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_2_5.xsd">
- <!-- 配置Spring的监听器,用于初始化ApplicationContext对象 -->
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:applicationContext*.xml</param-value>
- </context-param>
- <!-- 配置Struts2的主过滤器 -->
- <filter>
- <filter-name>struts2</filter-name>
- <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>struts2</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
- </web-app>
TestAction.java
- package cn.xbmu.oa.test;
- import javax.annotation.Resource;
- import org.springframework.context.annotation.Scope;
- import org.springframework.stereotype.Controller;
- import com.opensymphony.xwork2.ActionSupport;
- @Controller
- @Scope("prototype")
- public class TestAction extends ActionSupport {
- @Resource
- private TestService testService;
- @Override
- public String execute() throws Exception {
- System.out.println("---------->TestAction execute()");
- testService.saveTwoUser();
- return "success";
- }
- }
在浏览器中运行,报错,是因为在 int i = 1 / 0出抛出了异常
注释掉这句抛异常的语句,继续运行,成功。
struts2.3.20+spring4.0.2+hibernate4.3.4框架整合的更多相关文章
- struts2.3.24 + spring4.1.6 + hibernate4.3.11+ mysql5.5.25开发环境搭建及相关说明
一.目标 1.搭建传统的ssh开发环境,并成功运行(插入.查询) 2.了解c3p0连接池相关配置 3.了解验证hibernate的二级缓存,并验证 4.了解spring事物配置,并验证 5.了解spr ...
- 【SSH】---【Struts2、Hibernate5、Spring4集成开发】【SSH框架整合笔记】
Struts2.Hibernate5.Spring4集成开发步骤: 一.导入Jar包(基本的大致有41个,根据实际项目的需求自己添加) antlr-2.7.7.jar aopalliance.jar ...
- 最新版本的Struts2+Spring4+Hibernate4三大框架整合(截止2014-10-15,提供源码下载)
一. 项目名称:S2316S411H436 项目原型:Struts2.3.16 + Spring4.1.1 + Hibernate4.3.6 + Quartz2.2.1 源代码下载地址: 基本版:ht ...
- spring mvc4.1.6 + spring4.1.6 + hibernate4.3.11 + mysql5.5.25 开发环境搭建及相关说明
一.准备工作 开始之前,先参考上一篇: struts2.3.24 + spring4.1.6 + hibernate4.3.11 + mysql5.5.25 开发环境搭建及相关说明 struts2.3 ...
- [转]Struts2.3.16.1+Hibernate4.3.4+Spring4.0.2 框架整合
原文地址:http://blog.csdn.net/ycb1689/article/details/22928519 最新版Struts2+Hibernate+Spring整合 目前为止三大框架最新版 ...
- Struts2.3.16.1+Hibernate4.3.4+Spring4.0.2 框架整合(转)
原文 http://blog.csdn.net/songanling/article/details/22454973 最新版Struts2+Hibernate+Spring整合 目前为止三 ...
- struts2.3.16.1+hibernate4.3.4+spring4.0.2
把之前的老项目用新的改了 发现新的有点很方便啊 Struts2+Hibernate+Spring整合 用的是 struts2.3.16.1 hibernate4.3.4 ...
- (转)Spring4.2.5+Hibernate4.3.11+Struts2.3.24整合开发
http://blog.csdn.net/yerenyuan_pku/article/details/52902851 前面我们已经学会了Spring4.2.5+Hibernate4.3.11+Str ...
- 【Spring实战-2】Spring4.0.4整合Hibernate4.3.6
作者:ssslinppp 源程序下载:http://download.csdn.net/detail/ssslinppp/8751185 1. 摘要 本文主要讲解如何在Spring4.0. ...
随机推荐
- mysql8无法用navicat连接(mysql8加密方式的坑)
关键词:mysql8无法用navicat连接,navicat无法连接mysql8,mysql8,mysql8的加密方式 [1]mysql8 的坑 密码加密规则 在MySQL 8.0.以上版本中,cac ...
- numpy数组的索引和切片
numpy数组的索引和切片 基本切片操作 >>> import numpy as np >>> arr=np.arange(10) >>> arr ...
- [HAOI2018]苹果树题解
题目链接 大意:不解释 思路: 首先方案数共有n!种,第1个点只有1种选择,第2个点2种选择,生成2个选择的同时消耗一个,第3个点则有3种选择,依次类推共有n!种方案,由于最后答案*n!,故输出的实际 ...
- Kali安装在U盘+使用aircrack-ng套件
因为: Kali Linux 自带aircrack-ng 虚拟机VMware不能用笔记本内置网卡,需要另外买一个无线网卡,然而并不想买 不想给笔记本重装Kali Linux系统 有闲置的32GU盘 所 ...
- Thymeleaf模板中变量报红
在上顶部添加 <!--suppress ThymeleafVariablesResolveInspection --> 或者 <!--suppress ALL --> 都可以解 ...
- 关于js计算非等宽字体宽度的方法
准备一个容器 首先在body外插入一个absolute的容器避免重绘: const svgWidthTestContainer = document.createElement('svg'); svg ...
- qt treeview过滤
一,不多说直接上代码 QSortFilterProxyModel可实现过滤排序.但是如果直接使用只能对于父项进行过滤 这里需要继承 头文件 #include <QSortFilterProxyM ...
- MySQL 7种 JOIN连表方法
规定:左边的圆代表表 a,右边的代表 b. JOIN 关键字可以在两表之间选中任意部分.] 通过以下代码制造一些数据: delimiter // drop procedure if exists pr ...
- docker inspect命令查看镜像详细信息
使用 inspect 命令查看镜像详细信息,包括制作者.适应架构.各层的数字摘要等. # docker inspect --help Usage: docker inspect [OPTIONS] N ...
- AIX中设备管理
1.AIX系统中的设备概述 逻辑设备文件 #ls -l /dev 空设备文件 #/dev/null 设备的状态:undefined.defined.available.stopp ...