A blog about my daily tech ramblings.

Tuesday, 22 January 2013

2 comments:

  1. Another approach using @Configuration:


    @Bean
    public Properties retrieveSystemProperties(){
    return System.getProperties();
    }

    private Properties systemProperties;
    public Properties getSystemProperties() {
    return systemProperties;
    }
    @Resource(name="retrieveSystemProperties")
    public void setSystemProperties(Properties systemProperties) {
    this.systemProperties = systemProperties;
    }

    @Bean
    public MethodInvokingFactoryBean methodInvokingFactoryBean() {
    MethodInvokingFactoryBean methodInvokingFactoryBean = new MethodInvokingFactoryBean();
    methodInvokingFactoryBean.setStaticMethod("java.lang.System.setProperties");
    systemProperties.setProperty("http.keepAlive", "false");
    methodInvokingFactoryBean.setArguments(new Object[]{systemProperties});
    return methodInvokingFactoryBean;
    }

    ReplyDelete