-
Notifications
You must be signed in to change notification settings - Fork 2.6k
"NoSuchBeanDefinitionException: No bean named 'xxxxxxx' available" occurred when use together PropertyOverrideConfigurer #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@kazuki43zoo さん <beans>
<bean id="targetDataSource" class="org.springframework.jndi.jndiObjectFactoryBean">
<property name="jndiName" value="aa/bb"></property>
</bean>
<beans/> |
@pboonphong @harawata @cbegin @h3adache |
Hello @ryou-ks , This seems to be an issue with Spring bean initialization order.
ここは英語のみですが、ja.stackoverflow.com なら日本語 OK です(MyBatis の質問は少ないのでたまーにしか見てないですが)。teratail の方が活発みたいですね。 |
Changes in each version are listed here : https://github.com/mybatis/spring/releases 各バージョンの変更点は https://github.com/mybatis/spring/releases にあります。 |
@harawata さん |
Thanks for your report. Probably the following changes are affecting. I will suggest following two solutions to avoid this issue.
Ignore error for property overridingAdd option to ignore error at property overriding time. <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
<property name="locations">
<array>
<value>classpath:database.properties</value>
</array>
</property>
<property name="ignoreInvalidKeys" value="true"/> <!-- Add this line -->
</bean> Disable the property placeholder featureUse the <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.example"/>
<property name="processPropertyPlaceHolders" value="false"/> <!-- can omit this line because default is false -->
<!-- ... -->
</bean> |
@kazuki43zoo
using this solution can avoid this error, but message "NoSuchBeanDefinitionException: No bean named 'xxxxxxx' available" was still output to the debug level log .
this solution can avoid this error too, "NoSuchBeanDefinitionException: No bean named 'xxxxxxx' available" was no more output. but I don't know the reason why this error occurred |
@ryou-ks
The MyBatis-Spring perform a replace placeholder internally at xml element attribute and annotation attribute using Spring's placeholder feature( |
there is an error happened when I used mybatis-spring-2.0.5/spring 5.2.6/mybatis3.5.5 as follow:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'targetDataSource' available
How to solve this problem
my spring xml code
The text was updated successfully, but these errors were encountered: