Spring中的自动配置重新初始化
在Log4j中,有一个特性,在该特性中,可以对系统进行初始化,以进行间隔配置和监视。这允许log4j系统在属性文件更改时重新加载其属性。spring框架是否有这样一个配置观察工具,其中配置在更改时会重新加载。需要重新加载的配置不是Spring的applicationContext.xml,而是使用Spring初始化bean初始化的各种其他配置文件。Spring中的自动配置重新初始化,spring,Spring,在Log4j中,有一个特性,在该特性中,可以对系统进行初始化,以进行间隔配置和监视。这允许log4j系统在属性文件更改时重新加载其属性。spring框架是否有这样一个配置观察工具,其中配置在更改时会重新加载。需要重新加载的配置不是Spring的applicationContext.xml,而是使用Spring初始化bean初始化的各种其他配置文件。 AFAIK Spring不提供这种实用程序。但是,有一个第三方工具,它允许您更新整个web应用程序(包括Spring配置),而无需重新启动服务器 免
AFAIK Spring不提供这种实用程序。但是,有一个第三方工具,它允许您更新整个web应用程序(包括Spring配置),而无需重新启动服务器
免费试用,购买价格相当便宜。我发现了一个类似于Log4J的实用程序。它基本上是PropertyPlaceHolderConfigure的一个扩展,当属性发生变化时,它会重新加载属性。在重新加载spring应用程序上下文时,我会格外小心
你认为单例bean会发生什么?如果一个对象引用了singletonbean,它应该被更新吗 我使用JRebel进行开发,我会非常小心地期待它刷新您的配置。可以很好地使用Java,但不能使用Spring 如果您想添加上下文,我已通过以下方式完成:
public class ApplicationContextUtil
{
static String[] configFiles = {"applicationContextParent.xml"};
private static ApplicationContext context = null;
static
{
context = new ClassPathXmlApplicationContext ( configFiles );
}
public static void addContext( String[] newConfigFiles )
{
// add the new context to the previous context
ApplicationContext newContext = new ClassPathXmlApplicationContext ( newConfigFiles, context );
context = newContext;
}
public static ApplicationContext getApplicationContext ()
{
// return the context
return context;
}
}
这是您的上下文提供程序类。有关详细信息,请参阅我不想重新加载spring applicationcontext.xml或任何已加载的spring bean。我将尝试Phill Sacre发布的解决方案。这是在@Vadzim链接上改编的,已经死了!这可能有助于我们解决上述@pramodc84案例,更新链接:,