tng / config-builder Goto Github PK
View Code? Open in Web Editor NEWThis project forked from bmatthias/config-builder
Config builder
License: Apache License 2.0
This project forked from bmatthias/config-builder
Config builder
License: Apache License 2.0
Allow all top level annotation to be replaced using builder methods.
It would be nice to have "namespaces" for properties so I can get multiple configs from one properties file, command line, etc.
A null pointer exception occurs when passing in invalid command line options like
--help
This is due to the fact that there is no error message for CLIParseException in the error message setup.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/workflows/build.yml
actions/checkout v4
actions/setup-java v4
actions/checkout v4
codecov/codecov-action v4
actions/checkout v4
pom.xml
org.apache.maven.plugins:maven-release-plugin 3.1.1
org.sonatype.plugins:nexus-staging-maven-plugin 1.7.0
org.apache.maven.plugins:maven-compiler-plugin 3.13.0
org.jacoco:jacoco-maven-plugin 0.8.12
org.apache.maven.plugins:maven-surefire-plugin 3.3.1
org.apache.maven.plugins:maven-source-plugin 3.3.1
org.apache.maven.plugins:maven-javadoc-plugin 3.8.0
org.owasp:dependency-check-maven 10.0.3
org.apache.maven.plugins:maven-gpg-plugin 3.2.5
commons-cli:commons-cli 1.8.0
com.google.guava:guava 33.2.1-jre
org.hibernate.validator:hibernate-validator 6.2.5.Final
org.glassfish:jakarta.el 3.0.4
com.tngtech.java:property-loader 1.5.1
org.reflections:reflections 0.10.2
org.slf4j:slf4j-api 2.0.16
org.assertj:assertj-core 3.26.3
org.junit.jupiter:junit-jupiter 5.10.3
org.mockito:mockito-junit-jupiter 4.11.0
org.slf4j:slf4j-reload4j 2.0.16
.mvn/wrapper/maven-wrapper.properties
maven 3.9.8
Hi,
were using ConfigBuilder together with guice very successfully. However, in java SE it is necessary to have javax.el available at runtime in order for hibernate-validator to work. Is it possible that you include it as a dependency as described in https://github.com/hibernate/hibernate-validator#using-hibernate-validator ?
Thanks in advance for looking into this :-)
When using this config value for example
@DefaultValue("true")
private boolean headlessMode;
and merging with an existing config where the value is set to "false" explicitly, the value is set to "true" (which is not correct).
I've been using the config-builder within a project that uses PowerMock in the unit tests. With Java7 everything went fine, but when I switched to Java8 I received an exception ("java.lang.IllegalStateException: Failed to transform class with name ... ") during test initialization. I found out that I needed the latest javassist library to run my tests again with Java8.
Since the reflections-library depends on javassist it was enough to set the version from 0.9.8 to 0.9.9-RC2 (in maven-dependency-management), which contains the dependency to the latest javassist lib.
So it's just a recommendation to update the lib. Since I believe that there might be more incompatibilities when people work with Java8, it would make life easier for them, especially when they don't have to waste their time finding the solution.
Cheers!
There are several issues with our gh-pages:
New command line options cannot be added externally, so you cannot provide a custom command line switch like
--help
at the moment.
I have a problem where I need to have an expression containing ${} in my config file (for a camel endpoint). Unfortunately I got the following exception:
Caused by: com.tngtech.propertyloader.impl.filters.VariableResolvingFilterException: Error during variable resolution: No value found for variable file:name
at com.tngtech.propertyloader.impl.filters.VariableResolvingFilter.filterValue(VariableResolvingFilter.java:27)
at com.tngtech.propertyloader.impl.filters.ValueModifyingFilter.filter(ValueModifyingFilter.java:15)
at com.tngtech.propertyloader.PropertyLoader.filterProperties(PropertyLoader.java:277)
at com.tngtech.propertyloader.PropertyLoader.load(PropertyLoader.java:230)
at com.tngtech.configbuilder.ConfigBuilder.setupBuilderConfiguration(ConfigBuilder.java:144)
at com.tngtech.configbuilder.ConfigBuilder.build(ConfigBuilder.java:133)
... 20 more
It would be awesome if I could escape the expression somehow =)
Assume you have an entry with trailing whitespace in a properties file which is supposed to be mapped to an integer field. The ConfigBuilder fails with the exception:
com.tngtech.configbuilder.exception.PrimitiveParsingException: unable to parse "42 " to int
at com.tngtech.configbuilder.annotation.typetransformer.StringOrPrimitiveToPrimitiveTransformer.transform(StringOrPrimitiveToPrimitiveTransformer.java:21)
at com.tngtech.configbuilder.util.FieldValueTransformer.performNecessaryTransformations(FieldValueTransformer.java:82)
at com.tngtech.configbuilder.util.FieldValueTransformer.transformFieldValue(FieldValueTransformer.java:45)
at com.tngtech.configbuilder.util.FieldSetter.setFields(FieldSetter.java:36)
at com.tngtech.configbuilder.ConfigBuilder.build(ConfigBuilder.java:265)
A way around this might be to call String.trim() in StringOrPrimitiveToPrimitiveTransformer.
The project cannot be build anymore because it depends on Java 7. The only reason is the StringToPathTransformer class which requires the Path class that does not exist in Java 6. I suggest to remove that transformer.
Hello,
here
https://github.com/TNG/config-builder#usage-example
the class StringToPidFixTransformer implements TypeTransformer
public static class StringToPidFixTransformer implements TypeTransformer<String,PidFix>
but I think it should be extends
public static class StringToPidFixTransformer extends TypeTransformer<String,PidFix>
I'm right?
thank you for your tool - I like it!
The idea (thanks to @wolfs) is to enable creating complex transformers which can use more than one input, e.g. using the hierarchy of the property name:
Property-File content:
connection.a.host
connection.a.port
connection.a.user
connection.a.password
Java Config Class:
@ImportedValue('connection.a')
@TypeTransformers('MapToComplexObjectTransformer.class})
private ComplexObject connection;
Since primitive types can not be checked for 'null', it is not possible to check whether primitive fields of an existing config have already been set.
There should be a way to tell the Config-Builder which fields have already been set and schould not be overwritten.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.