If the builder has proper Java Beans compatible set
methods for its properties then you can do it in two stages
<bean id="fooBuilder" class="com.example.FooBuilder">
<property name="algorithm" value="simple" />
</bean>
<bean id="foo" factory-bean="fooBuilder" factory-method="build" />
But for something like a Guava CacheBuilder that uses fluent setters you're probably better off using Spring's JavaConfig approach for that part of the configuration instead of XML
@Configuration
public class AppConfig {
public @Bean Cache<String, MyObject> cache() {
return CacheBuilder.newBuilder()
.maximumSize(1000)
.softValues()
.build(cacheLoader);
}
// defined elsewhere, maybe in XML
private @Autowired CacheLoader<String, MyObject> cacheLoader;
}