How to configure a bean in the Spring xml bean configuration file is optional optional

how to set bean is not required

  • messageSource this bean is not required, and the Spring container can be started when messageSource injection fails. Is there this option in Spring"s xml configuration file, or is there any other way to solve this problem? Thank you in advance!

    <property name="basename" value="classpath:i18n/messages" />
    <property name="defaultEncoding" value="UTF-8"/>
</bean>
Mar.07,2021

does not seem to have such a configuration. If not, there should be no problem as long as the class corresponding to bean exists

.
Menu