Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 70 additions & 69 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
</exclusions>
</dependency>

<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>logback-ecs-encoder</artifactId>
<version>1.3.2</version>
<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>logback-ecs-encoder</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -172,45 +172,28 @@
</dependency>


<!--<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.16.1</version>
<exclusions>
<exclusion>
<artifactId>org.json</artifactId>
<groupId>json</groupId>
</exclusion>
</exclusions>
</dependency>-->

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version><!--$NO-MVN-MAN-VER$ -->
</dependency>
<!--<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.4.0</version>$NO-MVN-MAN-VER$
</dependency>-->

<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.5.0-rc1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>com.openkm</groupId>
<artifactId>sdk4j</artifactId>
Expand Down Expand Up @@ -423,7 +406,7 @@
<artifactId>org.apache.xmlgraphics</artifactId>
<groupId>batik-all</groupId>
</exclusion>

<exclusion>
<artifactId>org.bouncycastle</artifactId>
<groupId>bcpkix-jdk15on</groupId>
Expand All @@ -440,7 +423,7 @@
<artifactId>org.apache.santuario</artifactId>
<groupId>xmlsec</groupId>
</exclusion>

<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
Expand All @@ -457,45 +440,64 @@
<artifactId>spring-web</artifactId>
<version>6.1.6</version>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>

<!-- Jersey Core -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>2.30.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.30.1</version>
</dependency>


<!-- Jersey JSON Processing -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-processing</artifactId>
<version>2.30.1</version>
</dependency>

<!-- JAXB Runtime Implementation -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>

<!-- Jersey Core -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>2.30.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.30.1</version>
</dependency>


<!-- Jersey JSON Processing -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-processing</artifactId>
<version>2.30.1</version>
</dependency>

<!-- JAXB Runtime Implementation -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
Comment on lines +444 to +475
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codebase verification

πŸ› οΈ Refactor suggestion

Jersey dependencies need upgrade for Spring Boot 3.x compatibility

The project is using Spring Boot 3.2.2 which requires Jakarta EE, but the current Jersey dependencies (2.30.1) are using the older javax namespace. This is confirmed by:

  • Spring Boot version 3.2.2 in the pom.xml
  • Presence of Jakarta dependencies (jakarta.xml.bind-api)
  • Jersey 2.x dependencies using the older javax.ws.rs namespace

The original review comment is correct. You should upgrade to Jersey 3.x as it's compatible with Jakarta EE and Spring Boot 3.x. Specifically:

  • Update jersey-common from 2.30.1 to 3.1.5
  • Update jersey-server from 2.30.1 to 3.1.5
  • Update jersey-media-json-processing from 2.30.1 to 3.1.5
  • Replace javax.ws.rs-api with jakarta.ws.rs-api
πŸ”— Analysis chain

Review Jersey dependency versions for compatibility

The Jersey dependencies are using version 2.30.1, which might be outdated compared to the project's Spring Boot version (3.2.2). Consider upgrading to a newer version that's compatible with Jakarta EE.

Consider upgrading Jersey dependencies to version 3.x to align with Jakarta EE:

-            <version>2.30.1</version>
+            <version>3.1.5</version>

The previous command didn't work well, so let's try to gather more context about the project's dependencies and Spring Boot version to make an informed decision about Jersey compatibility.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for potential version conflicts with Jersey dependencies
rg "jersey" | grep -i "version"

Length of output: 29


Script:

#!/bin/bash
# Let's check the Spring Boot version and other relevant dependencies
cat pom.xml | grep -A 1 "<version>"

# Also check for any Jakarta EE dependencies
rg "jakarta" pom.xml

Length of output: 2470

<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.12.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-impl -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.12.6</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-jackson -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.12.6</version>
<scope>runtime</scope>
</dependency>

</dependencies>

<build>
<finalName>commonapi-v1.0</finalName>
<finalName>commonapi-v3.0.0</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -560,8 +562,7 @@
${target-properties} and
${source-properties}
</echo>
<concat destfile="${target-properties}"
append="yes"
<concat destfile="${target-properties}" append="yes"
force="yes">
<fileset file="${source-properties}">
</fileset>
Expand Down
5 changes: 5 additions & 0 deletions src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ eausadhaAuthorization=<Enter eausadha authorization key>
spring.main.allow-bean-definition-overriding=true
spring.main.allow-circular-references=true

jwt.secret=@env.JWT_SECRET_KEY@


#ELK logging file name
logging.file.name=@env.COMMON_API_LOGGING_FILE_NAME@


##grievance API call
updateGrievanceDetails = @env.GRIEVANCE_API_BASE_URL@/grsbepro/igemr1097/public/api/v1/state-wise/grievance-list
updateGrievanceTransactionDetails=@env.GRIEVANCE_API_BASE_URL@/grsbepro/igemr1097/public/api/v1/grievance_details/
Expand All @@ -152,3 +156,4 @@ grievanceUserName = @env.GRIEVANCE_USERNAME@
grievancePassword = @env.GRIEVANCE_PASSWORD@
grievanceUserAuthenticate = @env.GRIEVANCE_USER_AUTHENTICATE@
grievanceDataSyncDuration = @env.GRIEVANCE_DATA_SYNC_DURATION@

1 change: 1 addition & 0 deletions src/main/environment/common_dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ spring.main.allow-bean-definition-overriding=true
spring.main.allow-circular-references=true

fileBasePath =<Enter your required basepath here>/Doc
jwt.secret=

##grievance API call
updateGrievanceDetails = <ENTER GRIEVANCE_API_BASE_URL>/grsbepro/igemr1097/public/api/v1/state-wise/grievance-list
Expand Down
3 changes: 3 additions & 0 deletions src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ eAusadhaUrl=https://dlc.kar.nic.in/e-services/api/DWInstituteInward
eausadhaAuthorization=<Enter eausadha authorization key>
spring.main.allow-bean-definition-overriding=true
spring.main.allow-circular-references=true
jwt.secret=


##grievance API call
updateGrievanceDetails = <ENTER GRIEVANCE_API_BASE_URL>/grsbepro/igemr1097/public/api/v1/state-wise/grievance-list
Expand All @@ -125,3 +127,4 @@ grievancePassword = <Enter Grievance password>

grievanceUserAuthenticate = <Enter Grievance UserAuthenticate>
grievanceDataSyncDuration = <Enter Grievience Data Sync Duration>

2 changes: 2 additions & 0 deletions src/main/environment/common_test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ spring.main.allow-bean-definition-overriding=true
spring.main.allow-circular-references=true

fileBasePath =<Enter your required basepath here>/Doc
jwt.secret=


##grievance API call
updateGrievanceDetails = <ENTER GRIEVANCE_API_BASE_URL>/grsbepro/igemr1097/public/api/v1/state-wise/grievance-list
Expand Down
1 change: 1 addition & 0 deletions src/main/environment/common_uat.properties
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ spring.main.allow-bean-definition-overriding=true
spring.main.allow-circular-references=true

fileBasePath =<Enter your required basepath here>/Doc
jwt.secret=

##grievance API call
updateGrievanceDetails = <ENTER GRIEVANCE_API_BASE_URL>/grsbepro/igemr1097/public/api/v1/state-wise/grievance-list
Expand Down
31 changes: 25 additions & 6 deletions src/main/java/com/iemr/common/CommonApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
package com.iemr.common;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

import com.iemr.common.data.users.User;
import com.iemr.common.utils.IEMRApplBeans;

@SpringBootApplication
Expand All @@ -41,11 +45,11 @@ public IEMRApplBeans instantiateBeans() {
return new IEMRApplBeans();
}

@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}

public static void main(String[] args) {
SpringApplication.run(CommonApplication.class, args);
}
Expand All @@ -54,4 +58,19 @@ protected SpringApplicationBuilder configure(SpringApplicationBuilder applicatio
return application.sources(new Class[] { CommonApplication.class });
}

@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);

// Use StringRedisSerializer for keys (userId)
template.setKeySerializer(new StringRedisSerializer());

// Use Jackson2JsonRedisSerializer for values (Users objects)
Jackson2JsonRedisSerializer<User> serializer = new Jackson2JsonRedisSerializer<>(User.class);
template.setValueSerializer(serializer);

return template;
}
Comment on lines +61 to +74
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

Promote type-safety in the Redis template.

Although defining RedisTemplate<String, Object> works for storing various objects, if you only plan to store User objects, consider using a more specific type parameter (RedisTemplate<String, User>) for improved type safety. Also, validate that the Jackson serializer handles all required fields in the User class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not required

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate Limit Exceeded

@indraniBan have exceeded the limit for the number of chat messages per hour. Please wait 0 minutes and 33 seconds before sending another message.


}
29 changes: 25 additions & 4 deletions src/main/java/com/iemr/common/config/RedisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,35 @@

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.session.data.redis.config.ConfigureRedisAction;

import com.iemr.common.data.users.User;

@Configuration
public class RedisConfig {


@Bean
public ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}

@Bean
public ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}
public RedisTemplate<String, User> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, User> template = new RedisTemplate<>();
template.setConnectionFactory(factory);

// Use StringRedisSerializer for keys (userId)
template.setKeySerializer(new StringRedisSerializer());

// Use Jackson2JsonRedisSerializer for values (Users objects)
Jackson2JsonRedisSerializer<User> serializer = new Jackson2JsonRedisSerializer<>(User.class);
template.setValueSerializer(serializer);

return template;
}

}
Loading
Loading