Hi -
We are beginning to use Ignite and will be instantiating IgniteSpringBean
for use within our development sandbox. I am new to JavaBeans, Spring and
Ignite, so forgive me if this is a novice question.
We want to be able to use Spring Boot’s automatic configuration using Java
configuration without XML, and are trying to set Ignite properties at
runtime via Spring properties files, for example:
ignite.configuration.metrics-log-frequency=0
ignite.configuration.grid-name=MyDataGrid
However, when I try and bind properties of the
IgniteSpringBean.IgniteConfiguration inner bean, Spring fails with the
following error:
/Caused by: org.springframework.beans.NotReadablePropertyException: Invalid
property 'configuration' of bean class [org.apache.ignite.IgniteSpringBean]:
Bean property 'configuration' is not readable or has an invalid getter
method: Does the return type of the getter match the parameter type of the
setter?/
When looking at the IgniteSpringBean class, I realized it uses a JavaBeans
non-standard getter naming:
--
IgniteConfiguration configuration()
Gets the configuration of this grid instance.
void setConfiguration(IgniteConfiguration cfg)
Sets grid configuration.
--
I believe this is causing Spring to not be able to bind the configuration()
method.
I tried to work around this with by subclassing IgniteSpringBean and it
seems to work:
@Configuration
public class MyComputeGrid {
@Bean
@ConfigurationProperties(prefix="ignite", ignoreUnknownFields=false)
public MyIgniteSpringBean createIgnite() {
MyIgniteSpringBean isb = new MyIgniteSpringBean();
return isb;
}
// workaround the non-standard getter method of IgniteSpringBean
//
static private class MyIgniteSpringBean extends IgniteSpringBean {
public IgniteConfiguration getConfiguration() {
return configuration();
}
}
}
Am I missing the right way to do this? Is there another way to make this
work?
Thank you very much.
Kevin
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/IgniteSpringBean-getter-method-for-IgniteConfiguration-tp613.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.