Skip to content

Commit

Permalink
Merge pull request #255 from sixwaaaay/cve
Browse files Browse the repository at this point in the history
chore: avoid CVE
  • Loading branch information
sixwaaaay authored Mar 4, 2024
2 parents 3a92615 + ef8683a commit e12597e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion graal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
<version>3.2.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>io.sixwaaaay</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,32 @@

package io.sixwaaaay.sharingcomment.util;

/**
* DbContext is a thread local variable which is used to determine
* whether the current operation is a read or write operation.
*/
public class DbContext {
/**
* Thread local variable to store the current context.
* default value is WRITE.
*/
private static final ThreadLocal<DbContextEnum> CONTEXT = ThreadLocal.withInitial(() -> DbContextEnum.WRITE);


/**
* Set the current context.
*
* @param context the context to set.
*/
public static void set(DbContextEnum context) {
CONTEXT.set(context);
}

/**
* Get the current context.
*
* @return the current context.
*/
public static DbContextEnum get() {
return CONTEXT.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@

package io.sixwaaaay.sharingcomment.util;

/**
* Enum for database context
*/
public enum DbContextEnum {
READ, WRITE
/**
* indicate replica-datasource
*/
READ,
/**
* indicate default-datasource
*/
WRITE,
}

0 comments on commit e12597e

Please sign in to comment.