osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Improved Spring Boot Auto Configuration for tooling


Hi

JIRA Ticket:
https://issues.apache.org/jira/browse/CAMEL-12646

The issue is that when we generate spring boot auto configuration
classes for all the camel component starter JARs then the options that
uses non standard Java types (eg not numeric, boolean, string etc.)
are not included in the spring-boot tooling metadata. That is a json
file that spring-boot generates in the JAR file. So tooling does not
know about these options.

As 95% of the options are likely just plain string, boolean, numeric
etc then we haven't noticed that as much before.

An example is the camel-sql and camel-jdbc components where you can
configure a javax.sql.DataSource, for example in
application.properties

camel.component.sql.data-source = #myDataSource
camel.component.jdbc.data-source = #myDataSource

Before the fix in CAMEL-12646 then that option was not listed in the
tooling metadata file, but it was in the generated Configuration
class, so you could use it - but it was a bit tricky to know when the
tooling would not show it as an option.

So with CAMEL-12646 we have to relax the type of the option and let it
be a String type instead of eg javax.sql.DataSource so its supported
by Spring Boot Maven plugin to generate it in the metadata json file,
so its available for tooling (Spring Boot Maven plugin does not
support those complex Java types and just skip that option, so we
cannot do something about it, other than changing it to a String type,
but that is okay as you configure it as a String anyway, eg a bean
id). You can see a screenshow in the JIRA ticket when we have it
fixed.

There is a PR on github with the fix and the starter JARs upgraded, so
you are welcome to take a look and provide feedback.
https://github.com/apache/camel/pull/2423





-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2