This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8c726315b369ae9c81a6797a7de76997edc85823 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Jun 11 13:57:13 2019 +0200 CAMEL-13627: camel-main - Reuse options for main and camel-spring-boot --- .../spring/boot/CamelConfigurationProperties.java | 182 +++++++++++---------- 1 file changed, 93 insertions(+), 89 deletions(-) diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java index 2a06a51..5bb814c 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java @@ -23,20 +23,22 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.springboot") public class CamelConfigurationProperties extends DefaultConfigurationProperties<CamelConfigurationProperties> { - // IMPORTANT: Must include the options from DefaultConfigurationProperties as spring boot apt compiler - // needs to grab the documentation from the javadoc on the field. - - // Properties + // Spring Boot only Properties + // --------------------------- /** - * Sets the name of the CamelContext. + * Whether to use the main run controller to ensure the Spring-Boot application + * keeps running until being stopped or the JVM terminated. + * You typically only need this if you run Spring-Boot standalone. + * If you run Spring-Boot with spring-boot-starter-web then the web container keeps the JVM running. */ - private String name; + private boolean mainRunController; /** - * Timeout in seconds to graceful shutdown Camel. + * Whether to include non-singleton beans (prototypes) when scanning for RouteBuilder instances. + * By default only singleton beans is included in the context scan. */ - private int shutdownTimeout = 300; + private boolean includeNonSingletons; /** * Whether to log a WARN if Camel on Spring Boot was immediately shutdown after starting which @@ -45,6 +47,72 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties private boolean warnOnEarlyShutdown = true; /** + * Used for inclusive filtering component scanning of RouteBuilder classes with @Component annotation. + * The exclusive filtering takes precedence over inclusive filtering. + * The pattern is using Ant-path style pattern. + * + * Multiple patterns can be specified separated by comma. + * For example to include all classes starting with Foo use: **/Foo* + * To include all routes form a specific package use: com/mycompany/foo/* + * To include all routes form a specific package and its sub-packages use double wildcards: com/mycompany/foo/** + * And to include all routes from two specific packages use: com/mycompany/foo/*,com/mycompany/stuff/* + */ + private String javaRoutesIncludePattern; + + /** + * Used for exclusive filtering component scanning of RouteBuilder classes with @Component annotation. + * The exclusive filtering takes precedence over inclusive filtering. + * The pattern is using Ant-path style pattern. + * Multiple patterns can be specified separated by comma. + * + * For example to exclude all classes starting with Bar use: **/Bar* + * To exclude all routes form a specific package use: com/mycompany/bar/* + * To exclude all routes form a specific package and its sub-packages use double wildcards: com/mycompany/bar/** + * And to exclude all routes from two specific packages use: com/mycompany/bar/*,com/mycompany/stuff/* + */ + private String javaRoutesExcludePattern; + + /** + * Directory to scan for adding additional XML routes. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + private String xmlRoutes = "classpath:camel/*.xml"; + + /** + * Directory to scan for adding additional XML rests. + * You can turn this off by setting the value to false. + * + * Files can be loaded from either classpath or file by prefixing with classpath: or file: + * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml + * + * Multiple directories can be specified and separated by comma, such as: + * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml + */ + private String xmlRests = "classpath:camel-rest/*.xml"; + + // Default Properties via camel-main + // --------------------------------- + + // IMPORTANT: Must include the options from DefaultConfigurationProperties as spring boot apt compiler + // needs to grab the documentation from the javadoc on the field. + + /** + * Sets the name of the CamelContext. + */ + private String name; + + /** + * Timeout in seconds to graceful shutdown Camel. + */ + private int shutdownTimeout = 300; + + /** * Whether Camel should try to suppress logging during shutdown and timeout was triggered, * meaning forced shutdown is happening. And during forced shutdown we want to avoid logging * errors/warnings et all in the logs as a side-effect of the forced timeout. @@ -99,56 +167,6 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties private boolean loadTypeConverters = true; /** - * Used for inclusive filtering component scanning of RouteBuilder classes with @Component annotation. - * The exclusive filtering takes precedence over inclusive filtering. - * The pattern is using Ant-path style pattern. - * - * Multiple patterns can be specified separated by comma. - * For example to include all classes starting with Foo use: **/Foo* - * To include all routes form a specific package use: com/mycompany/foo/* - * To include all routes form a specific package and its sub-packages use double wildcards: com/mycompany/foo/** - * And to include all routes from two specific packages use: com/mycompany/foo/*,com/mycompany/stuff/* - */ - private String javaRoutesIncludePattern; - - /** - * Used for exclusive filtering component scanning of RouteBuilder classes with @Component annotation. - * The exclusive filtering takes precedence over inclusive filtering. - * The pattern is using Ant-path style pattern. - * Multiple patterns can be specified separated by comma. - * - * For example to exclude all classes starting with Bar use: **/Bar* - * To exclude all routes form a specific package use: com/mycompany/bar/* - * To exclude all routes form a specific package and its sub-packages use double wildcards: com/mycompany/bar/** - * And to exclude all routes from two specific packages use: com/mycompany/bar/*,com/mycompany/stuff/* - */ - private String javaRoutesExcludePattern; - - /** - * Directory to scan for adding additional XML routes. - * You can turn this off by setting the value to false. - * - * Files can be loaded from either classpath or file by prefixing with classpath: or file: - * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml - * - * Multiple directories can be specified and separated by comma, such as: - * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml - */ - private String xmlRoutes = "classpath:camel/*.xml"; - - /** - * Directory to scan for adding additional XML rests. - * You can turn this off by setting the value to false. - * - * Files can be loaded from either classpath or file by prefixing with classpath: or file: - * Wildcards is supported using a ANT pattern style paths, such as classpath:**/*camel*.xml - * - * Multiple directories can be specified and separated by comma, such as: - * file:/myapp/mycamel/*.xml,file:/myapp/myothercamel/*.xml - */ - private String xmlRests = "classpath:camel-rest/*.xml"; - - /** * Directory to load additional configuration files that contains * configuration values that takes precedence over any other configuration. * This can be used to refer to files that may have secret configuration that @@ -195,14 +213,6 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties private String routeFilterExcludePattern; /** - * Whether to use the main run controller to ensure the Spring-Boot application - * keeps running until being stopped or the JVM terminated. - * You typically only need this if you run Spring-Boot standalone. - * If you run Spring-Boot with spring-boot-starter-web then the web container keeps the JVM running. - */ - private boolean mainRunController; - - /** * To specify for how long time in seconds to keep running the JVM before automatic terminating the JVM. * You can use this to run Spring Boot for a short while. */ @@ -221,12 +231,6 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties private int durationMaxMessages; /** - * Whether to include non-singleton beans (prototypes) when scanning for RouteBuilder instances. - * By default only singleton beans is included in the context scan. - */ - private boolean includeNonSingletons; - - /** * Is used to limit the maximum length of the logging Camel message bodies. If the message body * is longer than the limit, the log message is clipped. Use -1 to have unlimited length. * Use for example 1000 to log at most 1000 characters. @@ -417,6 +421,23 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties private String threadNamePattern; // Getters & setters + // ----------------- + + public boolean isMainRunController() { + return mainRunController; + } + + public void setMainRunController(boolean mainRunController) { + this.mainRunController = mainRunController; + } + + public boolean isIncludeNonSingletons() { + return includeNonSingletons; + } + + public void setIncludeNonSingletons(boolean includeNonSingletons) { + this.includeNonSingletons = includeNonSingletons; + } public boolean isWarnOnEarlyShutdown() { return warnOnEarlyShutdown; @@ -457,21 +478,4 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties public void setXmlRests(String xmlRests) { this.xmlRests = xmlRests; } - - public boolean isMainRunController() { - return mainRunController; - } - - public void setMainRunController(boolean mainRunController) { - this.mainRunController = mainRunController; - } - - public boolean isIncludeNonSingletons() { - return includeNonSingletons; - } - - public void setIncludeNonSingletons(boolean includeNonSingletons) { - this.includeNonSingletons = includeNonSingletons; - } - }