csh
commit
c60ad33102
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4" />
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="2012B-day07-poi" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="2012B-day07-poi" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,37 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="date" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SpringJavaInjectionPointsAutowiringInspection" enabled="true" level="INFORMATION" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,237 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BranchesTreeState">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e444dd1e-755b-40d8-b3fc-2aa0db285e0a" name="Default Changelist" comment="csh">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/2012B-day07-poi.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/2012B-day07-poi.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/bwie/PoiApplication.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/bwie/pojo/Student.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/bwie/pojo/User.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/bwie/service/UserService.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/bwie/service/UserServiceImpl.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/resources/application.properties" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/resources/ehcache.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/test/java/com/bwie/EasyExcelTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/test/java/com/bwie/EhcacheTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/test/java/com/bwie/PoiApplicationTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/test/java/com/bwie/PoiReadTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/classes/application.properties" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/classes/com/bwie/PoiApplication.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/classes/com/bwie/pojo/Student.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/classes/com/bwie/pojo/User.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/classes/com/bwie/service/UserService.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/classes/com/bwie/service/UserServiceImpl.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/classes/ehcache.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/test-classes/com/bwie/EasyExcelTest.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/test-classes/com/bwie/EhcacheTest.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/test-classes/com/bwie/PoiApplicationTest.class" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/target/test-classes/com/bwie/PoiReadTest.class" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="mavenHome" value="$PROJECT_DIR$/../../tools/maven/apache-maven-3.6.1" />
|
||||
<option name="userSettingsFile" value="D:\tools\maven\apache-maven-3.6.1\conf\settings.xml" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectId" id="2NcXMKKgTmAzC8Vray26LDp1kqf" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/resources" />
|
||||
<property name="settings.editor.selected.configurable" value="MavenSettings" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="D:\ws\2012B-day07-poi\src\main\resources" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="JUnit.EhcacheTest.testKey">
|
||||
<configuration name="EasyExcelTest.write3" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||
<module name="2012B-day07-poi" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.bwie.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="PACKAGE_NAME" value="com.bwie" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.bwie.EasyExcelTest" />
|
||||
<option name="METHOD_NAME" value="write3" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="EasyExcelTest.write4" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||
<module name="2012B-day07-poi" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.bwie.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="PACKAGE_NAME" value="com.bwie" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.bwie.EasyExcelTest" />
|
||||
<option name="METHOD_NAME" value="write4" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="EhcacheTest.testCachePut" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||
<module name="2012B-day07-poi" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.bwie.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="PACKAGE_NAME" value="com.bwie" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.bwie.EhcacheTest" />
|
||||
<option name="METHOD_NAME" value="testCachePut" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="EhcacheTest.testCacheable" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||
<module name="2012B-day07-poi" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.bwie.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="PACKAGE_NAME" value="com.bwie" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.bwie.EhcacheTest" />
|
||||
<option name="METHOD_NAME" value="testCacheable" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="EhcacheTest.testKey" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||
<module name="2012B-day07-poi" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.bwie.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="PACKAGE_NAME" value="com.bwie" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.bwie.EhcacheTest" />
|
||||
<option name="METHOD_NAME" value="testKey" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="JUnit.EhcacheTest.testKey" />
|
||||
<item itemvalue="JUnit.EhcacheTest.testCacheable" />
|
||||
<item itemvalue="JUnit.EhcacheTest.testCachePut" />
|
||||
<item itemvalue="JUnit.EasyExcelTest.write4" />
|
||||
<item itemvalue="JUnit.EasyExcelTest.write3" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SshConsoleOptionsProvider">
|
||||
<option name="myEncoding" value="UTF-8" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="e444dd1e-755b-40d8-b3fc-2aa0db285e0a" name="Default Changelist" comment="" />
|
||||
<created>1679964294902</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1679964294902</updated>
|
||||
<workItem from="1679964298170" duration="99000" />
|
||||
<workItem from="1679964416226" duration="3244000" />
|
||||
<workItem from="1679967741133" duration="2258000" />
|
||||
<workItem from="1679981911555" duration="7090000" />
|
||||
<workItem from="1680050334529" duration="5072000" />
|
||||
<workItem from="1680064463408" duration="26000" />
|
||||
<workItem from="1700037902533" duration="21000" />
|
||||
<workItem from="1700062177972" duration="277000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="csh" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="csh" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="586" y="198" key="#Inspections" timestamp="1700062459321">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
<state x="586" y="198" key="#Inspections/0.0.1920.1040@0.0.1920.1040" timestamp="1700062459321" />
|
||||
<state x="819" y="366" key="FileChooserDialogImpl" timestamp="1700062232533">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
<state x="819" y="366" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1700062232533" />
|
||||
<state x="552" y="252" key="Vcs.Push.Dialog.v2" timestamp="1700062418095">
|
||||
<screen x="0" y="0" width="1920" height="1040" />
|
||||
</state>
|
||||
<state x="552" y="252" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1700062418095" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4" />
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>2012B-day07-poi</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.2.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--热部署-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!--获得properties属性-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!--lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!--测试模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.15</version>
|
||||
</dependency>
|
||||
|
||||
<!-- excel2003使用的包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.17</version>
|
||||
</dependency>
|
||||
<!-- excel2007+使用的包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.2.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.6.6</version>
|
||||
</dependency>
|
||||
|
||||
<!--缓存依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
<version>2.10.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
|
||||
@SpringBootApplication
|
||||
//1 开启缓存
|
||||
@EnableCaching
|
||||
public class PoiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PoiApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.bwie.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Student {
|
||||
|
||||
private Integer studentId;
|
||||
private String studentName;
|
||||
private Integer age;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.bwie.pojo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.NumberFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ContentStyle;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
|
||||
@Data
|
||||
public class User {
|
||||
@ExcelProperty(value = {"用户信息","用户编号"})
|
||||
@ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 40)
|
||||
private Integer userId;
|
||||
@ExcelProperty(value={"用户信息","用户名称"})
|
||||
private String userName;
|
||||
@NumberFormat("#.##%")
|
||||
@ExcelProperty(value = "用户工资")
|
||||
private Double userSal;
|
||||
// @ExcelProperty("用户年龄")
|
||||
@ExcelIgnore
|
||||
private Integer age;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie.service;
|
||||
|
||||
import com.bwie.pojo.User;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
public User findById(String id);
|
||||
|
||||
public Integer randomValue();
|
||||
|
||||
public void evict(String id);
|
||||
|
||||
public void evict2();
|
||||
public Integer keyMethod(Integer a,String str);
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.bwie.service;
|
||||
|
||||
import com.bwie.pojo.User;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
// @CachePut 更新缓存
|
||||
// @CacheEvict 删除缓存
|
||||
//ehcache 缓存==> 使用 key[默认是参数] value[返回值]
|
||||
//spel表达式 ognl xxx.mapper.xml el
|
||||
@Cacheable(value="aaa",key = "'user:'+#id",condition = "#id.length()>5")
|
||||
public User findById(String id){
|
||||
System.out.println("findById方法执行------------");
|
||||
User user = new User(); //查询数据库的
|
||||
return user;
|
||||
}
|
||||
|
||||
//使用了缓存,执行方法
|
||||
@CachePut(value="bbb",key = "'rondomKey'")
|
||||
public Integer randomValue(){
|
||||
System.out.println("random方法执行........................");
|
||||
return new Random().nextInt(1000);
|
||||
}
|
||||
//清除缓存
|
||||
@CacheEvict(value="aaa",key = "'user:'+#id" )
|
||||
public void evict(String id){}
|
||||
|
||||
//清除所有缓存===>实时更新
|
||||
@CacheEvict(value="aaa",allEntries = true)
|
||||
public void evict2(){}
|
||||
|
||||
@Cacheable(value="aaa")
|
||||
public Integer keyMethod(Integer a,String str){
|
||||
return 1000;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
|
||||
<!--timeToIdleSeconds 当缓存闲置n秒后销毁 -->
|
||||
<!--timeToLiveSeconds 当缓存存活n秒后销毁 -->
|
||||
<!-- 缓存配置
|
||||
name:缓存名称。
|
||||
maxElementsInMemory:缓存最大个数。
|
||||
eternal:对象是否永久有效,一但设置了,timeout将不起作用。
|
||||
timeToIdleSeconds:设置对象在失效前的允许闲置时间(单位:秒)。仅当eternal=false对象不是永久有效时使用,可选属性,默认值是0,也就是可闲置时间无穷大。
|
||||
timeToLiveSeconds:设置对象在失效前允许存活时间(单位:秒)。最大时间介于创建时间和失效时间之间。仅当eternal=false对象不是永久有效时使用,默认是0.,也就是对象存活时间无穷大。
|
||||
overflowToDisk:当内存中对象数量达到maxElementsInMemory时,Ehcache将会对象写到磁盘中。 diskSpoolBufferSizeMB:这个参数设置DiskStore(磁盘缓存)的缓存区大小。默认是30MB。每个Cache都应该有自己的一个缓冲区。
|
||||
maxElementsOnDisk:硬盘最大缓存个数。
|
||||
diskPersistent:是否缓存虚拟机重启期数据 Whether the disk
|
||||
store persists between restarts of the Virtual Machine. The default value
|
||||
is false.
|
||||
diskExpiryThreadIntervalSeconds:磁盘失效线程运行时间间隔,默认是120秒。 memoryStoreEvictionPolicy:当达到maxElementsInMemory限制时,Ehcache将会根据指定的策略去清理内存。默认策略是
|
||||
LRU(最近最少使用)。你可以设置为FIFO(先进先出)或是LFU(较少使用)。
|
||||
clearOnFlush:内存数量最大时是否清除。 -->
|
||||
|
||||
<!--FIFO,first in first out,先进先出。
|
||||
LFU, Less Frequently Used,一直以来最少被使用的。如上面所讲,缓存的元素有一个hit属性,hit值最小的将会被清出缓存。
|
||||
LRU,Least Recently Used,最近最少使用的,缓存的元素有一个时间戳,当缓存容量满了,而又需要腾出地方来缓存新的元素的时候,那么现有缓存元素中时间戳离当前时间最远的元素将被清出缓存。
|
||||
-->
|
||||
<!-- 磁盘缓存位置 -->
|
||||
<diskStore path="java.io.tmpdir" />
|
||||
<!-- 默认缓存 -->
|
||||
<defaultCache
|
||||
maxElementsInMemory="10000"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="120"
|
||||
timeToLiveSeconds="120"
|
||||
maxElementsOnDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
|
||||
<persistence strategy="localTempSwap" />
|
||||
</defaultCache>
|
||||
|
||||
<!-- 测试 -->
|
||||
<cache name="aaa"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="2400"
|
||||
timeToLiveSeconds="5"
|
||||
maxEntriesLocalHeap="10000"
|
||||
maxEntriesLocalDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
overflowToDisk="false"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
</cache>
|
||||
|
||||
<!-- 测试 -->
|
||||
<cache name="bbb"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="2400"
|
||||
timeToLiveSeconds="2400"
|
||||
maxEntriesLocalHeap="10000"
|
||||
maxEntriesLocalDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
overflowToDisk="false"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
</cache>
|
||||
|
||||
|
||||
|
||||
</ehcache>
|
|
@ -0,0 +1,100 @@
|
|||
package com.bwie;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.bwie.pojo.Student;
|
||||
import com.bwie.pojo.User;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@SpringBootTest
|
||||
public class EasyExcelTest {
|
||||
|
||||
public List<User> getData() {
|
||||
List<User> list = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
User user = new User();
|
||||
user.setUserId(1000 + i);
|
||||
user.setUserName("tom" + (i + 1));
|
||||
user.setUserSal(1000.0);
|
||||
user.setAge(10);
|
||||
list.add(user);
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void write() {
|
||||
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
||||
// 如果这里想使用03 则 传入excelType参数即可
|
||||
String path = "C:\\Users\\xx\\Desktop\\ee1.xlsx";
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("userId");
|
||||
EasyExcel.write(path, User.class).includeColumnFiledNames(set).sheet("sheet").doWrite(getData());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void write2() {
|
||||
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
||||
// 如果这里想使用03 则 传入excelType参数即可
|
||||
String path = "C:\\Users\\xx\\Desktop\\ee1.xlsx";
|
||||
|
||||
EasyExcel.write(path, User.class).sheet("sheet").doWrite(getData());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void write3() {
|
||||
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
||||
// 如果这里想使用03 则 传入excelType参数即可
|
||||
String path = "C:\\Users\\xx\\Desktop\\ee1.xlsx";
|
||||
String templatepath = "C:\\Users\\xx\\Desktop\\a.xlsx";
|
||||
|
||||
Student student=new Student();
|
||||
student.setAge(10);
|
||||
student.setStudentName("tom");
|
||||
student.setStudentId(1001);
|
||||
EasyExcel.write(path).withTemplate(templatepath).sheet().doFill(student);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void write4() {
|
||||
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
||||
// 如果这里想使用03 则 传入excelType参数即可
|
||||
String path = "C:\\Users\\xx\\Desktop\\ee1.xlsx";
|
||||
String templatepath = "C:\\Users\\xx\\Desktop\\a.xlsx";
|
||||
|
||||
Student student=new Student();
|
||||
student.setAge(10);
|
||||
student.setStudentName("tom");
|
||||
student.setStudentId(1001);
|
||||
|
||||
Student student2=new Student();
|
||||
student2.setAge(10);
|
||||
student2.setStudentName("tom2");
|
||||
student2.setStudentId(1001);
|
||||
|
||||
Student student3=new Student();
|
||||
student3.setAge(30);
|
||||
student3.setStudentName("tom3");
|
||||
student3.setStudentId(1001);
|
||||
|
||||
Student student4=new Student();
|
||||
student4.setAge(20);
|
||||
student4.setStudentName("tom4");
|
||||
student4.setStudentId(1001);
|
||||
|
||||
List<Student> list=new ArrayList<>();
|
||||
list.add(student);
|
||||
list.add(student2);
|
||||
list.add(student3);
|
||||
list.add(student4);
|
||||
list.add(student);
|
||||
|
||||
EasyExcel.write(path).withTemplate(templatepath).sheet().doFill(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.bwie;
|
||||
|
||||
import com.bwie.pojo.User;
|
||||
import com.bwie.service.UserService;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import net.sf.ehcache.Element;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class EhcacheTest {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private CacheManager cacheManager;
|
||||
@Test
|
||||
public void testCacheable() throws InterruptedException {
|
||||
User byId = userService.findById("100000");
|
||||
|
||||
System.out.println(byId);
|
||||
|
||||
|
||||
System.out.println("------------------------------------");
|
||||
userService.evict2(); //使缓存失效
|
||||
|
||||
User byId2 = userService.findById("100000");
|
||||
|
||||
System.out.println(byId2);
|
||||
|
||||
System.out.println("-------------------------------");
|
||||
Cache aaa = cacheManager.getCache("aaa");
|
||||
List keys = aaa.getKeys();
|
||||
System.out.println(keys);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCachePut(){
|
||||
Integer integer = userService.randomValue();
|
||||
System.out.println(integer);
|
||||
System.out.println("-------------------------------");
|
||||
Integer integer2 = userService.randomValue();
|
||||
System.out.println(integer2);
|
||||
|
||||
Cache bbb = cacheManager.getCache("bbb");
|
||||
System.out.println(bbb.getKeys());
|
||||
|
||||
for (Object key : bbb.getKeys()) {
|
||||
Element element = bbb.get(key);
|
||||
System.out.println(element.getObjectValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKey(){
|
||||
|
||||
Integer abc = userService.keyMethod(1000, "abc");
|
||||
Cache bbb = cacheManager.getCache("aaa");
|
||||
|
||||
|
||||
for (Object key : bbb.getKeys()) {
|
||||
System.out.println(key);
|
||||
Element element = bbb.get(key);
|
||||
System.out.println(element.getObjectValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
package com.bwie;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
@SpringBootTest
|
||||
public class PoiApplicationTest {
|
||||
|
||||
@Test
|
||||
public void write03Test() throws Exception {
|
||||
Workbook workbook=new HSSFWorkbook();
|
||||
//创建工作表
|
||||
Sheet sheet = workbook.createSheet("表1");
|
||||
//创建行
|
||||
Row row = sheet.createRow(0);
|
||||
//创建单元格
|
||||
Cell cell11 = row.createCell(0);
|
||||
cell11.setCellValue("姓名");
|
||||
|
||||
Cell cell12 = row.createCell(1);
|
||||
cell12.setCellValue("年龄");
|
||||
|
||||
//创建行
|
||||
Row row2 = sheet.createRow(1);
|
||||
//创建单元格
|
||||
Cell cell21 = row2.createCell(0);
|
||||
cell21.setCellValue("小明");
|
||||
|
||||
Cell cell22 = row2.createCell(1);
|
||||
cell22.setCellValue("18");
|
||||
|
||||
OutputStream out= new FileOutputStream("C:\\Users\\xx\\Desktop\\aa.xls");
|
||||
workbook.write(out);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void write07Test() throws Exception {
|
||||
Workbook workbook=new XSSFWorkbook();
|
||||
//创建工作表
|
||||
Sheet sheet = workbook.createSheet("07表1");
|
||||
//创建行
|
||||
Row row = sheet.createRow(0);
|
||||
//创建单元格
|
||||
Cell cell11 = row.createCell(0);
|
||||
cell11.setCellValue("姓名");
|
||||
|
||||
Cell cell12 = row.createCell(1);
|
||||
cell12.setCellValue("年龄");
|
||||
|
||||
//创建行
|
||||
Row row2 = sheet.createRow(1);
|
||||
//创建单元格
|
||||
Cell cell21 = row2.createCell(0);
|
||||
cell21.setCellValue("小明");
|
||||
|
||||
Cell cell22 = row2.createCell(1);
|
||||
cell22.setCellValue("18");
|
||||
|
||||
OutputStream out= new FileOutputStream("C:\\Users\\xx\\Desktop\\bb.xlsx");
|
||||
workbook.write(out);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void write03TestBigData() throws Exception {
|
||||
Workbook workbook=new HSSFWorkbook();
|
||||
|
||||
long l = System.currentTimeMillis();
|
||||
//创建工作表
|
||||
Sheet sheet = workbook.createSheet("表1");
|
||||
//创建行
|
||||
Row row = sheet.createRow(0);
|
||||
//创建单元格
|
||||
Cell cell11 = row.createCell(0);
|
||||
cell11.setCellValue("姓名");
|
||||
|
||||
Cell cell12 = row.createCell(1);
|
||||
cell12.setCellValue("年龄");
|
||||
|
||||
for (int i = 0; i < 65535; i++) {
|
||||
//创建行
|
||||
Row row2 = sheet.createRow(i);
|
||||
//创建单元格
|
||||
Cell cell21 = row2.createCell(0);
|
||||
cell21.setCellValue("小明"+i);
|
||||
|
||||
Cell cell22 = row2.createCell(1);
|
||||
cell22.setCellValue("18");
|
||||
|
||||
}
|
||||
|
||||
|
||||
OutputStream out= new FileOutputStream("C:\\Users\\xx\\Desktop\\aa.xls");
|
||||
workbook.write(out);
|
||||
|
||||
long l2 = System.currentTimeMillis();
|
||||
|
||||
System.out.println(l2-l);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void write07TestBigData() throws Exception {
|
||||
Workbook workbook=new XSSFWorkbook();
|
||||
|
||||
long l = System.currentTimeMillis();
|
||||
//创建工作表
|
||||
Sheet sheet = workbook.createSheet("表1");
|
||||
//创建行
|
||||
Row row = sheet.createRow(0);
|
||||
//创建单元格
|
||||
Cell cell11 = row.createCell(0);
|
||||
cell11.setCellValue("姓名");
|
||||
|
||||
Cell cell12 = row.createCell(1);
|
||||
cell12.setCellValue("年龄");
|
||||
|
||||
for (int i = 0; i < 65535; i++) {
|
||||
//创建行
|
||||
Row row2 = sheet.createRow(i);
|
||||
//创建单元格
|
||||
Cell cell21 = row2.createCell(0);
|
||||
cell21.setCellValue("小明"+i);
|
||||
|
||||
Cell cell22 = row2.createCell(1);
|
||||
cell22.setCellValue("18");
|
||||
|
||||
}
|
||||
|
||||
|
||||
OutputStream out= new FileOutputStream("C:\\Users\\xx\\Desktop\\bb.xlsx");
|
||||
workbook.write(out);
|
||||
|
||||
long l2 = System.currentTimeMillis();
|
||||
|
||||
System.out.println(l2-l);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void write07TestBigData2() throws Exception {
|
||||
//100条
|
||||
Workbook workbook=new SXSSFWorkbook();
|
||||
|
||||
long l = System.currentTimeMillis();
|
||||
//创建工作表
|
||||
Sheet sheet = workbook.createSheet("表1");
|
||||
//创建行
|
||||
Row row = sheet.createRow(0);
|
||||
//创建单元格
|
||||
Cell cell11 = row.createCell(0);
|
||||
cell11.setCellValue("姓名");
|
||||
|
||||
Cell cell12 = row.createCell(1);
|
||||
cell12.setCellValue("年龄");
|
||||
|
||||
for (int i = 0; i < 65535; i++) {
|
||||
//创建行
|
||||
Row row2 = sheet.createRow(i);
|
||||
//创建单元格
|
||||
Cell cell21 = row2.createCell(0);
|
||||
cell21.setCellValue("小明"+i);
|
||||
|
||||
Cell cell22 = row2.createCell(1);
|
||||
cell22.setCellValue("18");
|
||||
|
||||
}
|
||||
|
||||
|
||||
OutputStream out= new FileOutputStream("C:\\Users\\xx\\Desktop\\bb.xlsx");
|
||||
workbook.write(out);
|
||||
|
||||
long l2 = System.currentTimeMillis();
|
||||
|
||||
System.out.println(l2-l);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.bwie;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@SpringBootTest
|
||||
public class PoiReadTest {
|
||||
|
||||
@Test
|
||||
public void read() throws Exception {
|
||||
InputStream in= new FileInputStream("C:\\Users\\xx\\Desktop\\bb.xlsx");
|
||||
Workbook workbook=new XSSFWorkbook(in);
|
||||
|
||||
Sheet sheetAt = workbook.getSheetAt(0);
|
||||
|
||||
Row row = sheetAt.getRow(0);
|
||||
|
||||
Cell cell = row.getCell(0);
|
||||
|
||||
|
||||
|
||||
System.out.println(cell);
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
|
||||
<!--timeToIdleSeconds 当缓存闲置n秒后销毁 -->
|
||||
<!--timeToLiveSeconds 当缓存存活n秒后销毁 -->
|
||||
<!-- 缓存配置
|
||||
name:缓存名称。
|
||||
maxElementsInMemory:缓存最大个数。
|
||||
eternal:对象是否永久有效,一但设置了,timeout将不起作用。
|
||||
timeToIdleSeconds:设置对象在失效前的允许闲置时间(单位:秒)。仅当eternal=false对象不是永久有效时使用,可选属性,默认值是0,也就是可闲置时间无穷大。
|
||||
timeToLiveSeconds:设置对象在失效前允许存活时间(单位:秒)。最大时间介于创建时间和失效时间之间。仅当eternal=false对象不是永久有效时使用,默认是0.,也就是对象存活时间无穷大。
|
||||
overflowToDisk:当内存中对象数量达到maxElementsInMemory时,Ehcache将会对象写到磁盘中。 diskSpoolBufferSizeMB:这个参数设置DiskStore(磁盘缓存)的缓存区大小。默认是30MB。每个Cache都应该有自己的一个缓冲区。
|
||||
maxElementsOnDisk:硬盘最大缓存个数。
|
||||
diskPersistent:是否缓存虚拟机重启期数据 Whether the disk
|
||||
store persists between restarts of the Virtual Machine. The default value
|
||||
is false.
|
||||
diskExpiryThreadIntervalSeconds:磁盘失效线程运行时间间隔,默认是120秒。 memoryStoreEvictionPolicy:当达到maxElementsInMemory限制时,Ehcache将会根据指定的策略去清理内存。默认策略是
|
||||
LRU(最近最少使用)。你可以设置为FIFO(先进先出)或是LFU(较少使用)。
|
||||
clearOnFlush:内存数量最大时是否清除。 -->
|
||||
|
||||
<!--FIFO,first in first out,先进先出。
|
||||
LFU, Less Frequently Used,一直以来最少被使用的。如上面所讲,缓存的元素有一个hit属性,hit值最小的将会被清出缓存。
|
||||
LRU,Least Recently Used,最近最少使用的,缓存的元素有一个时间戳,当缓存容量满了,而又需要腾出地方来缓存新的元素的时候,那么现有缓存元素中时间戳离当前时间最远的元素将被清出缓存。
|
||||
-->
|
||||
<!-- 磁盘缓存位置 -->
|
||||
<diskStore path="java.io.tmpdir" />
|
||||
<!-- 默认缓存 -->
|
||||
<defaultCache
|
||||
maxElementsInMemory="10000"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="120"
|
||||
timeToLiveSeconds="120"
|
||||
maxElementsOnDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
|
||||
<persistence strategy="localTempSwap" />
|
||||
</defaultCache>
|
||||
|
||||
<!-- 测试 -->
|
||||
<cache name="aaa"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="2400"
|
||||
timeToLiveSeconds="5"
|
||||
maxEntriesLocalHeap="10000"
|
||||
maxEntriesLocalDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
overflowToDisk="false"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
</cache>
|
||||
|
||||
<!-- 测试 -->
|
||||
<cache name="bbb"
|
||||
eternal="false"
|
||||
timeToIdleSeconds="2400"
|
||||
timeToLiveSeconds="2400"
|
||||
maxEntriesLocalHeap="10000"
|
||||
maxEntriesLocalDisk="10000000"
|
||||
diskExpiryThreadIntervalSeconds="120"
|
||||
overflowToDisk="false"
|
||||
memoryStoreEvictionPolicy="LRU">
|
||||
</cache>
|
||||
|
||||
|
||||
|
||||
</ehcache>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue