I apologize ahead of time, because I feel like I've taken a few steps backward
and am now hung up on a simple newbie issue regarding application properties
and Spring configuring beans.
Backstory: I've now created about a dozen Camel projects, all reusing the same
basic "architecture" I set up a long time ago and the way I imported some
custom Spring files and properties.
But now I'm having a frustrating newbie problem getting the Spring Boot app to
see any bean configurations in a "default" Spring or Camel XML file.
I'm sure it's likely a classpath issue or something. But in case it's
something more, I willingly embarrass myself and ask you all...
Let's make it real simple:
In IntelliJ, create a new project using the archetype:
camel-archetype-spring-boot.
You get the file structure:
.
├── java
│ └── org
│ └── apache
│ └── camel
│ └── archetypes
│ ├── MySpringBean.java
│ ├── MySpringBootApplication.java
│ └── MySpringBootRouter.java
└── resources
├── application.properties
└── META-INF
├── LICENSE.txt
└── NOTICE.txt
I now comment out the Spring-injected @Value("${greeting}") in MySpringBean and
am trying to replace it with a simple camel-context.xml where I Spring
configure the 'say' class variable containing the "greeting".
-----
camel-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
[...blah blah blah...]
<bean id="myBean" class="org.apache.camel.archetypes.MySpringBean">
<property name="say" value="Hey There"/>
</bean>
</beans>
-----
MySpringBean.java:
@Component("myBean")
public class MySpringBean {
// @Value("${greeting}")
private String say;
public void setSay(String say) {
this.say = say;
}
public String saySomething() {
System.out.println("*** say = " + say);
return say;
}
}
-----
When I run MySpringBootApplication all I get is:
*** say = null
*** say = null
*** say = null
etc
FWIW, I tried naming the file both "camel-context.xml" and "camelContext.xml"
as well as putting the files under "resources" and "resources/spring". But
none of those 4 configurations works.
Thanks for any help.
(I am now positioning my palm directly in front of my space so I can smack
myself once my simple error is pointed out.....)
Ron