Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: avoid CVE #255

Merged
merged 1 commit into from
Mar 4, 2024
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
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,
}
Loading