I'm new to spring-boot and attempting to populate a property in a spring-boot XML with a function return value from a Java class but the class doesn't seem to be visible to the spring-boot loader. I'm probably just missing an annotation or something but any input would be great.
Here is my Java class and method:
public class AppMqttConfig {
@Bean
public SSLSocketFactory getSocketFactory()
throws Exception {
ResourceLoader resourceLoader = new DefaultResourceLoader();
String caCrtFile = resourceLoader.getResource("classpath:/non-prod/AmazonRootCA1.pem").getFile().getAbsolutePath();
String crtFile = resourceLoader.getResource("classpath:/non-prod/certificate.pem.crt").getFile().getAbsolutePath();
String keyFile = resourceLoader.getResource("classpath:/non-prod/private.pem.key").getFile().getAbsolutePath();
Security.addProvider(new BouncyCastleProvider());
}
}
And here is where I'm referencing the return value of getSocketFactory:
<bean id="pahoMqttClientFactory"
class="org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory">
<property name="connectionOptions">
<bean class="org.eclipse.paho.client.mqttv3.MqttConnectOptions">
<property name="serverURIs">
<list>
<value>${mqtt.broker.url}</value>
</list>
</property>
<property name="connectionTimeout" value="${mqtt.client.connectionTimeout}" />
<property name="keepAliveInterval" value="${mqtt.client.keepAliveInterval}" />
<property name="cleanSession" value="${mqtt.session.clean}" />
<property name="socketFactory" value="#{AppMqttConfig.getSocketFactory()}" />
</bean>
</property>
</bean>
This is the error I'm receiving:
Property or field AppMqttConfig cannot be found on object of type org.springframework.beans.factory.config.BeanExpressionContext - maybe not public or not valid?