我使用spring boot @Configuration 类注释创建了一个bean,如下所示
@Configuration
public class CustomConfiguration {
@Bean
public MyEnvironmentProcessor myEnvironmentProcessor(Environment env) {
return new MyEnvironmentProcessor(env);
}
}
在其中一个应用程序中,我使用 Spring XML 创建 bean,然后使用 Spring boot 加载它们,我试图在 XML 中创建相同的 bean,但它不起作用,我在下面尝试
<bean id="myEnvironmentProcessor " class="com.example.MyEnvironmentProcessor">
<constructor-arg>
<bean class="org.springframework.core.env.Environment"/>
</constructor-arg>
</bean>
如何在 Spring XML 中创建等效的基于 Java 的 bean?
春季版本:5.2.4.RELEASE 春季启动版本:2.2.5.RELEASE