SpringXML配置,默认惰性init和Spring属性不起作用
我想确定我的bean是否是lazyinit,这取决于从属性文件加载的属性 我的配置文件中有很多属性,除了默认的lazy init中的属性外,其他属性都被正确解析 我试图直接在bean上设置lazy init,但仍然有一个异常 这是另一种方法吗 config.properties:SpringXML配置,默认惰性init和Spring属性不起作用,spring,properties,lazy-initialization,Spring,Properties,Lazy Initialization,我想确定我的bean是否是lazyinit,这取决于从属性文件加载的属性 我的配置文件中有很多属性,除了默认的lazy init中的属性外,其他属性都被正确解析 我试图直接在bean上设置lazy init,但仍然有一个异常 这是另一种方法吗 config.properties: lazyInit=true ... <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sprin
lazyInit=true
...
<?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-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
<bean name="tDatasource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close" lazy-init="${lazyInit}">
...
springConfiguration-datasource.xml:
lazyInit=true
...
<?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-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
<bean name="tDatasource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close" lazy-init="${lazyInit}">
...
因为这个问题的背景不清楚。 尽管如此,我还是建议使用@Lazy注释,而不是在Springbean配置文件中进行配置
这当然可以避免所有错误。请发布您的上下文,以包括de bean定义和属性占位符配置器。否,编辑您的问题并添加该问题、bean定义和完整异常日志。您可以单击问题上的编辑按钮。在那里添加详细信息并删除这些评论。我遇到了同样的问题,有人解决了吗?如果你使用的是maven,那么你可以使用maven replacer插件