`

让spring启动时应用不需要加载数据库【default-lazy-init="true"】

    博客分类:
  • JAVA
 
阅读更多
spring启动时应用不需要加载数据库,需要时在加载,如何实现?

2010-10-22 11:22 提问者悬赏:15分 |zxqwh| 分类:其他编程语言 | 浏览1195次
也就是说应用启动时不连接数据库,其它不使用数据库的应用也能启动,当用到数据库操作的应用需要操作数据库时,在加载数据库,怎么实现,我说情况和hibernate的延迟加载是不一样的,我是用的是spring+hibernate实现DAO的开发模式。  你的回答好像没有理解我的意思,说的其实好像不是这样实现,我的业务需求是开始时不连接数据库,等用到数据库时在做相应的操作,相当于动态的加载数据库,你说的延迟加载时加载完了,获取对象时候的事了。

<beans>加一个属性:<beans default-lazy-init="true">
就会导致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" 
	xmlns:aop="http://www.springframework.org/schema/aop" 
	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  
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop-2.5.xsd" 
	default-lazy-init="true">
       


但是不要每个applicationContext-xxx.xml文件都加这个。只是在需要延迟加载的文件里面写上这段。




2014-3-28 14:24:02 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_34\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.6.0_34\jre\bin;C:/Program Files/Java/jdk1.6.0_34/bin/../jre/bin/server;C:/Program Files/Java/jdk1.6.0_34/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_34/bin/../jre/lib/amd64;E:\Oracle11gR2\Administrator\product\11.2.0\dbhome_1\bin;.;C:\Program Files\Java\jdk1.6.0_34\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;D:\tools\apache-maven-2.2.1\bin;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Common Files\Easysoft\Shared\;C:\Program Files\Common Files\Easysoft\Shared\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;E:\Microsoft SQL Server\Shared\100\Tools\Binn\;E:\Microsoft SQL Server\Shared\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;D:\sqluldr64;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;D:\Program Files (x86);D:\eclipse;;.
2014-3-28 14:24:02 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:wxsc' did not find a matching property.
2014-3-28 14:24:02 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8989
2014-3-28 14:24:02 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 569 ms
2014-3-28 14:24:02 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2014-3-28 14:24:02 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.36
2014-3-28 14:24:03 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2014-03-28 14:24:03,366 INFO [org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization started
2014-03-28 14:24:03,408 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@40c07527: display name [Root WebApplicationContext]; startup date [Fri Mar 28 14:24:03 CST 2014]; root of context hierarchy
2014-03-28 14:24:03,496 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from URL [file:/H:/project249/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/wxsc/WEB-INF/classes/applicationContext.xml]
2014-03-28 14:24:04,135 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from URL [file:/H:/project249/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/wxsc/WEB-INF/classes/applicationContext-persist.xml]
2014-03-28 14:24:04,157 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from URL [file:/H:/project249/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/wxsc/WEB-INF/classes/applicationContext-service.xml]
2014-03-28 14:24:04,176 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from URL [file:/H:/project249/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/wxsc/WEB-INF/classes/applicationContext-service-liuhaihui.xml]
2014-03-28 14:24:04,200 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@40c07527]: org.springframework.beans.factory.support.DefaultListableBeanFactory@bc22eb
2014-03-28 14:24:04,301 INFO [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] - Loading properties file from class path resource [jdbc.properties]
2014-03-28 14:24:04,353 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@bc22eb: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,pabpp,cabpp,dataSource,entityManagerFactory,transactionManager,javaMailSender,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,managerTx,validateService,deleteToolService,request.musicMessageHandler,request.newsMessageHandler,request.textMessageHandler,request.voiceMessageHandler,serverNumMessageHandlerChain,serverNumberMenuService,subscribeNumberMenuService,dataAnalysisService]; root of factory hierarchy
2014-03-28 14:24:04,422 INFO [org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 1055 ms
2014-03-28 14:24:04,551 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-default.xml]
2014-03-28 14:24:04,665 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-plugin.xml]
2014-03-28 14:24:04,691 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Unable to locate configuration files of the name struts.xml, skipping
2014-03-28 14:24:04,691 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts.xml]
2014-03-28 14:24:04,699 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from applicationMessage
2014-03-28 14:24:04,799 INFO [org.apache.struts2.spring.StrutsSpringObjectFactory] - Initializing Struts-Spring integration...
2014-03-28 14:24:04,799 INFO [com.opensymphony.xwork2.spring.SpringObjectFactory] - Setting autowire strategy to name
2014-03-28 14:24:04,800 INFO [org.apache.struts2.spring.StrutsSpringObjectFactory] - ... initialized Struts-Spring integration successfully
2014-03-28 14:24:05,659 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-default.xml]
2014-03-28 14:24:05,696 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts-plugin.xml]
2014-03-28 14:24:05,698 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Unable to locate configuration files of the name struts.xml, skipping
2014-03-28 14:24:05,698 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] - Parsing configuration file [struts.xml]
2014-03-28 14:24:05,702 INFO [org.apache.struts2.config.BeanSelectionProvider] - Loading global messages from applicationMessage
2014-03-28 14:24:05,712 INFO [org.apache.struts2.spring.StrutsSpringObjectFactory] - Initializing Struts-Spring integration...
2014-03-28 14:24:05,712 INFO [com.opensymphony.xwork2.spring.SpringObjectFactory] - Setting autowire strategy to name
2014-03-28 14:24:05,713 INFO [org.apache.struts2.spring.StrutsSpringObjectFactory] - ... initialized Struts-Spring integration successfully
2014-3-28 14:24:05 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8989
2014-3-28 14:24:06 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2014-3-28 14:24:06 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/19  config=null
2014-3-28 14:24:06 org.apache.catalina.startup.Catalina start
信息: Server startup in 3512 ms
2014-03-28 14:24:23,813 INFO [com.mchange.v2.log.MLog] - MLog clients using log4j logging.
2014-03-28 14:24:23,899 INFO [com.mchange.v2.c3p0.C3P0Registry] - Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10]
2014-03-28 14:24:24,054 INFO [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] - Building JPA container EntityManagerFactory for persistence unit 'AppProductPersistenceUnit'
2014-03-28 14:24:24,095 INFO [org.hibernate.cfg.annotations.Version] - Hibernate Annotations 3.4.0.GA
2014-03-28 14:24:24,111 INFO [org.hibernate.cfg.Environment] - Hibernate 3.3.2.GA
2014-03-28 14:24:24,113 INFO [org.hibernate.cfg.Environment] - hibernate.properties not found
2014-03-28 14:24:24,116 INFO [org.hibernate.cfg.Environment] - Bytecode provider name : javassist
2014-03-28 14:24:24,121 INFO [org.hibernate.cfg.Environment] - using JDK 1.4 java.sql.Timestamp handling
2014-03-28 14:24:24,208 INFO [org.hibernate.annotations.common.Version] - Hibernate Commons Annotations 3.1.0.GA
2014-03-28 14:24:24,212 INFO [org.hibernate.ejb.Version] - Hibernate EntityManager 3.4.0.GA
2014-03-28 14:24:24,234 INFO [org.hibernate.ejb.Ejb3Configuration] - Processing PersistenceUnitInfo [
	name: AppProductPersistenceUnit
	...]
2014-03-28 14:24:24,436 INFO [org.hibernate.cfg.AnnotationBinder] - Binding entity from annotated class: com.kington.wxsc.model.db.OrderStatistic
2014-03-28 14:24:24,472 INFO [org.hibernate.cfg.annotations.EntityBinder] - Bind entity com.kington.wxsc.model.db.OrderStatistic on table wxsc_order_statistics
2014-03-28 14:24:24,537 INFO [org.hibernate.cfg.AnnotationConfiguration] - Hibernate Validator not found: ignoring
2014-03-28 14:24:24,560 INFO [org.hibernate.cfg.search.HibernateSearchEventListenerRegister] - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
2014-03-28 14:24:24,607 INFO [org.hibernate.connection.ConnectionProviderFactory] - Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
2014-03-28 14:24:24,610 INFO [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider] - Using provided datasource
2014-03-28 14:24:24,665 INFO [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource] - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1b60udb9121ivj6qczq01|5fbd7d0e, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1b60udb9121ivj6qczq01|5fbd7d0e, idleConnectionTestPeriod -> 0, initialPoolSize -> 2, jdbcUrl -> jdbc:mysql://localhost:3306/wxsc?useUnicode=true&characterEncoding=UTF-8, lastAcquisitionFailureDefaultUser -> null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 3, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
2014-03-28 14:24:24,790 INFO [org.hibernate.cfg.SettingsFactory] - RDBMS: MySQL, version: 5.1.41-community
2014-03-28 14:24:24,790 INFO [org.hibernate.cfg.SettingsFactory] - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.4 ( $Date: 2006-10-19 17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )
2014-03-28 14:24:24,812 INFO [org.hibernate.dialect.Dialect] - Using dialect: org.hibernate.dialect.MySQLDialect
2014-03-28 14:24:24,817 INFO [org.hibernate.transaction.TransactionFactoryFactory] - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
2014-03-28 14:24:24,818 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2014-03-28 14:24:24,818 INFO [org.hibernate.cfg.SettingsFactory] - Automatic flush during beforeCompletion(): disabled
2014-03-28 14:24:24,819 INFO [org.hibernate.cfg.SettingsFactory] - Automatic session close at end of transaction: disabled
2014-03-28 14:24:24,819 INFO [org.hibernate.cfg.SettingsFactory] - JDBC batch size: 15
2014-03-28 14:24:24,819 INFO [org.hibernate.cfg.SettingsFactory] - JDBC batch updates for versioned data: disabled
2014-03-28 14:24:24,819 INFO [org.hibernate.cfg.SettingsFactory] - Scrollable result sets: enabled
2014-03-28 14:24:24,820 INFO [org.hibernate.cfg.SettingsFactory] - JDBC3 getGeneratedKeys(): enabled
2014-03-28 14:24:24,820 INFO [org.hibernate.cfg.SettingsFactory] - Connection release mode: auto
2014-03-28 14:24:24,821 INFO [org.hibernate.cfg.SettingsFactory] - Maximum outer join fetch depth: 3
2014-03-28 14:24:24,821 INFO [org.hibernate.cfg.SettingsFactory] - Default batch fetch size: 1
2014-03-28 14:24:24,821 INFO [org.hibernate.cfg.SettingsFactory] - Generate SQL with comments: enabled
2014-03-28 14:24:24,821 INFO [org.hibernate.cfg.SettingsFactory] - Order SQL updates by primary key: disabled
2014-03-28 14:24:24,821 INFO [org.hibernate.cfg.SettingsFactory] - Order SQL inserts for batching: disabled
2014-03-28 14:24:24,821 INFO [org.hibernate.cfg.SettingsFactory] - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2014-03-28 14:24:24,823 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] - Using ASTQueryTranslatorFactory
2014-03-28 14:24:24,823 INFO [org.hibernate.cfg.SettingsFactory] - Query language substitutions: {}
2014-03-28 14:24:24,823 INFO [org.hibernate.cfg.SettingsFactory] - JPA-QL strict compliance: enabled
2014-03-28 14:24:24,823 INFO [org.hibernate.cfg.SettingsFactory] - Second-level cache: enabled
2014-03-28 14:24:24,823 INFO [org.hibernate.cfg.SettingsFactory] - Query cache: disabled
2014-03-28 14:24:24,823 INFO [org.hibernate.cfg.SettingsFactory] - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
2014-03-28 14:24:24,824 INFO [org.hibernate.cfg.SettingsFactory] - Optimize cache for minimal puts: disabled
2014-03-28 14:24:24,824 INFO [org.hibernate.cfg.SettingsFactory] - Structured second-level cache entries: disabled
2014-03-28 14:24:24,828 INFO [org.hibernate.cfg.SettingsFactory] - Echoing all SQL to stdout
2014-03-28 14:24:24,828 INFO [org.hibernate.cfg.SettingsFactory] - Statistics: enabled
2014-03-28 14:24:24,828 INFO [org.hibernate.cfg.SettingsFactory] - Deleted entity synthetic identifier rollback: disabled
2014-03-28 14:24:24,829 INFO [org.hibernate.cfg.SettingsFactory] - Default entity-mode: pojo
2014-03-28 14:24:24,829 INFO [org.hibernate.cfg.SettingsFactory] - Named query checking : enabled
2014-03-28 14:24:24,859 INFO [org.hibernate.impl.SessionFactoryImpl] - building session factory
2014-03-28 14:24:25,014 INFO [org.hibernate.impl.SessionFactoryObjectFactory] - Not binding factory to JNDI, no JNDI name configured
2014-03-28 14:24:25,025 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Running hbm2ddl schema update
2014-03-28 14:24:25,025 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - fetching database metadata
2014-03-28 14:24:25,030 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - updating schema
2014-03-28 14:24:25,064 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - table found: wxsc.wxsc_order_statistics
2014-03-28 14:24:25,064 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - columns: [delivery_time, delivery_type, gift, value_added_tax_invoice, order_quantity, updatetime, product_id, product_attribute, consignee, invoice, product_name, total_sum, express_type, remarks, order_system_category, express_number, unit_price, version, invoice_content, invoice_type, createtime, id, order_amount, account_payable, place_order_account_number, order_time, customer_payment_term, seller_remarks, payment_confirm_time, order_remarks, order_date, store_name, order_number, customer_address, consignee_telephone_number, customer_name, balance_payment, freight_amount, order_status, post_invoice, article_number, customer_telephone_number, consignee_address, invoice_head, customer_id, order_type]
2014-03-28 14:24:25,064 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - foreign keys: []
2014-03-28 14:24:25,064 INFO [org.hibernate.tool.hbm2ddl.TableMetadata] - indexes: [primary]
2014-03-28 14:24:25,064 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - schema update complete

  • 大小: 49.3 KB
分享到:
评论

相关推荐

    浅谈spring中的default-lazy-init参数和lazy-init

    下面小编就为大家带来一篇浅谈spring中的default-lazy-init参数和lazy-init。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    spring 配置文件简单说明

    1. 1)default-init-method ="方法名" 定义在此配置文件中的bean都会执行指定的init方法。 2)default-destroy-...3)default-lazy-init ="false|true" 定义在此配置文件中的bean都会延迟加载。 ....................

    Spring IOC Bean标签属性介绍(教学视频+源代码)

    1.8.1 配置文件都不加lazy-init=true 1.8.2 被依赖者(Student)加了lazy-init="true" 1.8.3 依赖者(依赖其它类)(User)加了lazy-init="true" 1.8.4 两者都加lazy-init="true" 1.9 init-method和destroy-method ...

    图片延迟加载-juery-lazyload

    图片延迟加载-juery-lazyload 很不错

    HelloSpring.zip

    我的博客中“maven环境搭建及Spring入门”的项目代码。在idea中运行成功。 1。创建IOC容器 2。通过xml装配对象 【简单类型用value、复杂(引用类型)用ref、数组,集合,Map的装配】 ...default-lazy-init=true

    ng2-image-lazy-load, Angular2图像迟缓加载程序库.zip

    ng2-image-lazy-load, Angular2图像迟缓加载程序库 当前未维护现在,你可以尝试使用这个伟大的延迟加载 库来实现。 上面的库唯一没有的是Web工作支持- 我希望在未来的某个时候循环,或者者为tjoskar提供辅助。 ng2-...

    前端项目-vue-lazyload.zip

    前端项目-vue-lazyload,用于在Vue.js应用程序中延迟加载图像的Vue模块。

    前端开源库-markdown-it-lazy-headers

    前端开源库-markdown-it-lazy-headersMarkdown it Lazy Headers,Lazy ATX Headers插件用于Markdown it

    springmvcmybatis

    -- &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="false"&gt; &lt;property name="driverClassName" value="${jdbc.driver}" /&gt; &lt;property name="url" ...

    spring1.2学习心得分享

    可以使用&lt;beans default-lazy-init=""/&gt;延缓所有组件实例化 b.销毁时机:单例对象容器close()负责销毁 c.创建对象的模式(使用范围):scope控制,可以使用singleton和prototype d.初始化:&lt;bean init-method="...

    浅谈vue中使用图片懒加载vue-lazyload插件详细指南

    当网络请求比较慢的时候,提前给这张图片添加一个像素比较低的占位图片,不至于堆叠在一块,或显示大片空白,让用户体验更好一点。 使用方式 使用vue的 vue-lazyload 插件 插件地址:...

    前端项目-vanilla-lazyload.zip

    前端项目-vanilla-lazyload,Lazyload是一个快速、轻量级和灵活的脚本,仅在图像即将进入可滚动区域的视区时才加载图像,并对渐进式JPEG图像格式提供了极好的支持。类型脚本模块定义可用。

    react-lazy-with-preload:具有预加载支持的React.lazy()!

    react-lazy-with-preload包装了React.lazy() API,并增加了在首次渲染组件之前对其进行预加载的功能。安装npm install react-lazy-with-preload用法前: import { lazy , Suspense } from "react" ;const Other...

    spring1.1开发理解

    可以使用&lt;beans default-lazy-init=""/&gt;延缓所有组件实例化 b.销毁时机:单例对象容器close()负责销毁 c.创建对象的模式(使用范围):scope控制,可以使用singleton和prototype d.初始化:&lt;bean init-method="...

    前端项目-jquery-lazyload-any.zip

    前端项目-jquery-lazyload-any,jquery插件为图像、iframe或任何东西提供了lazyload函数。

    前端开源库-lazy-dependable

    前端开源库-lazy-dependable懒惰可靠,通过懒惰依赖解析实现可靠

    spring学习心得

    可以使用&lt;beans default-lazy-init=""/&gt;延缓所有组件实例化 b.销毁时机:单例对象容器close()负责销毁 c.创建对象的模式(使用范围):scope控制,可以使用singleton和prototype d.初始化:&lt;bean init-method="...

    Spring3.2.4+Quartz2.2.0 Demo

    &lt;bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt; &lt;property name="triggers"&gt; &lt;ref bean="myJobTrigger" /&gt; ...

    封装通用的Spring3+Struts2+MyBatis3的CRUD+条件分页查询,Spring+Quartz调度,FunctionCharts图像化工具

    -- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 --&gt; &lt;bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt; ...

    hexo-lazyload-image:用于Hexo的lazyload图像插件

    hexo-lazyload-image hexo-lazyload-image是一个hexo插件,用于使所有图像自动支持lazyload。 借助此功能,它将改善很多加载性能。 所有延迟加载图像仅在它们位于当前视口内时显示。 不必担心lazyload SEO问题,因为...

Global site tag (gtag.js) - Google Analytics