Maven version upgrade
Upgrade to Spring boot 2.2.6
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.6.RELEASE</version> </parent>
Upgrade to latest tracer
<dependency> <groupId>org.egov.services</groupId> <artifactId>tracer</artifactId> <version>2.0.0-SNAPSHOT</version> </dependency>
Add typescript export for generating interfaces for all API request/response classes like below. Modify the class names according to the service respectively
<plugin> <groupId>cz.habarta.typescript-generator</groupId> <artifactId>typescript-generator-maven-plugin</artifactId> <version>2.22.595</version> <executions> <execution> <id>generate</id> <goals> <goal>generate</goal> </goals> <phase>process-classes</phase> </execution> </executions> <configuration> <jsonLibrary>jackson2</jsonLibrary> <classes> <class>org.egov.collection.model.PaymentResponse</class> <class>org.egov.collection.model.PaymentRequest</class> <class>org.egov.collection.model.PaymentSearchCriteria</class> <class>org.egov.collection.web.contract.RemittanceRequest</class> <class>org.egov.collection.web.contract.RemittanceResponse</class> <class>org.egov.collection.web.contract.RemittanceSearchRequest</class> <class>org.egov.collection.web.contract.PaymentWorkflowRequest</class> <class>org.egov.collection.web.contract.BankAccountServiceMappingReq</class> <class>org.egov.collection.web.contract.BankAccountServiceMappingResponse</class> <class>org.egov.collection.web.contract.BankAccountServiceMappingSearchReq</class> </classes> <customTypeNaming> <customTypeNaming>org.egov.collection.model.enums.Purpose:BillDetailPurpose</customTypeNaming> </customTypeNaming> <customTypeMappings> <customTypeMapping>org.egov.common.contract.request.User:User</customTypeMapping> <customTypeMapping>org.egov.common.contract.request.RequestInfo:RequestInfo</customTypeMapping> <customTypeMapping>org.egov.common.contract.response.ResponseInfo:ResponseInfo</customTypeMapping> </customTypeMappings> <namespace>Digit</namespace> <debug>true</debug> <outputKind>module</outputKind> </configuration> </plugin>
Add an entry for new context-path as below
Please make sure you replace all properties from flyway.xxx to spring.flyway.xxx in the application.properties spring.flyway.url= spring.flyway.user= spring.flyway.password= spring.flyway.table= spring.flyway.baseline-on-migrate= spring.flyway.outOfOrder= spring.flyway.locations= spring.flyway.enabled=
Also make sure not to change flyway.table value, or delete this in your config
Replace the property spring.flyway.baselineOnmigrate=
db/migration/main
byspring.flyway.locations=classpath:/db/migration/main
Add CHANGELOG.md to each service
Increment the service number/patch version in pom.xml
Make sure the KafkaConsumers are working
run the command - mvn clean package. If build is successful , test the application/services in local.
Raise a PR to merge it with the master.
Deployment to any environments should now work for both old and new spring versions.
Issues Observed :
Fix : spring.flyway.locations=classpath:/db/migration/main
Add this path to flyway.locations while running in local
2.
Fix : This error occurs when mvn clean package is run in terminal. Add lenient()
.when() , wherever Mockito.when() is used. - https://www.baeldung.com/mockito-unnecessary-stubbing-exception
3.
Fix : Add snapshot dependency in <repositories> section
<repository>
<id>repo.egovernments.org.snapshots</id>
<name>eGov ERP Releases Repository</name>
<url><https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/</url>>
</repository>
4.
Fix : Replace org.springframework.kafka.listener.config.ContainerProperties by org.springframework.kafka.listener.ContainerProperties
Remove below snippet -
properties.setPauseEnabled(true);
properties.setPauseAfter(0);
properties.setGenericErrorHandler(kafkaConsumerErrorHandler);
Replace factory.getContainerProperties().setErrorHandle()
by factory.setErrorHandler()
5
If there is a build failure like below
then use this base image given below in your repo /build/maven folder, there is a Dockerfile. Just replace the content of second line of the file.