|
|
@@ -0,0 +1,19 @@
|
|
|
+package space.anyi.serve.config;
|
|
|
+
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import space.anyi.codesandbox.CodeSandBox;
|
|
|
+import space.anyi.codesandbox.JVMNativeCodeSandBox;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 代码沙箱自动配置,注册沙箱实现Bean
|
|
|
+ * 后续新增 Docker 沙箱时,可在此通过 @ConditionalOnProperty 切换实现
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+public class CodeSandBoxAutoConfiguration {
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public CodeSandBox codeSandBox() {
|
|
|
+ return new JVMNativeCodeSandBox();
|
|
|
+ }
|
|
|
+}
|