Regarding your question:
What happens if you have a application.yml file and put the property in
there?
Well the my-property is set like:
myProperty: someValue
in the application.yml as well as the application-test.yml

Trying to access the property like:
@Value(„${myProperty}")
private String myProperty;
Works.
But in the test-case I try to create my route-builder like:
@Override
public RouteBuilder createRouteBuilder() {
    LOG.info(„MyProperty: #" + myProperty);
    return new MyRouteBuilder();
}

Whereas MyRoute Builder is implemented as follows:

@Component
public class MyRouteBuilder extends RouteBuilder {

   private static final Logger LOGGER =
Logger.getLogger(MyRouteBuilder.class);
   
   @Override
   public void configure() throws Exception {      
      // REGISTER ROUTE TO IMPORT CSV
      from("file:{{myProperty}}/?noop=true") // FILE PATH FROM PROPERTIES
         .log(LoggingLevel.INFO, "PROCESSING FILE ${file:name}...")
         
And in this freshly instantiated class the property does not seem to be
available any more in case the instantiation happens in the Unit test.

A different value (used to connect to a message queue) could be read without
problems from a @Bean annotated configuration class.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Properties-Spring-Boot-Unit-test-not-found-tp5779765p5779785.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to