Posts

Showing posts from November, 2022

Spring Cloud Contract

Image
Spring Cloud Contract  is a project that, simply put, helps us write Consumer-Driven Contracts (CDC). This ensures the contract between a Producer and a Consumer, in a distributed system – for both HTTP-based and message-based interactions. Producer – Server Side For our producer side, we'll need the spring-cloud-starter-contract-verifier dependency. Producer Side Setup Test stubs are in /src/test/resources/contracts/ package. When the build is run, the plugin automatically generates a test class named ContractVerifierTest that extends our BaseTestClass and puts it in /target/generated-test-sources/contracts/. The names of the test methods are derived from the prefix “validate_” concatenated with the names of our Groovy test stubs. For the above Groovy file, the generated method name will be “validate_find_provider_by_id()”. Consumer – Client Side The consumer side of our CDC consume stubs generated by the producer side through HTTP interaction to maintain the contract...

Jenkins docker image with docker inside

Image
  Jenkins  is an open source, Java-based automation server that offers an easy way to set up a continuous integration and continuous delivery (CI/CD) pipeline. Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. Continuous Delivery (CD) is the process to build, test, configure and deploy from a build to a production environment.    Jenkins docker image with docker inside Step 1/ Create Dockerfile extending the official Alpine image. Then get jenkins.war and docker from official sites. Step 2/ Jenkins admin user setup to set a default admin user and password, by creating a Groovy script file. Step 3/ Adding Plugins to auto install some selected plugins. Step 4/ Build Your Custom Jenkins Image Here  is a fully functional Jenkins server.

How can I make reflection work on JDK 16 and later?

Image
  Reflection is another form of meta-programming, and just as valid, as the type-based parameters that you see in most languages these days. Reflection is powerful and generic, and reflective programs are a high order of maintainability (when used correctly, of course) and more so than purely object-orientated or procedural programs.  Reflection is fantastic for building tools for developers. With the advent of Java 9  the approach  to encapsulate has changed and the scary-sounding message appeared: WARNING: An illegal reflective access operation has occurred   WARNING: Illegal reflective access by ReflBytecodeName (file:/Users/ben/projects/books/resources/) to method sun.invoke.util.BytecodeName.parseBytecodeName(java.lang.String) WARNING: Please consider reporting this to the maintainers of ReflBytecodeName   WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations   WARNING: All illegal access operation...