如何在 Spring Boot 中使用自定义类加载器加载 bean
\n\n我需要加密 Spring Boot 项目。
\n\n起初我尝试使用proguard,但失败了,因为 spring 使用大量 Annotations 并且它有DI。
\n\n然后我尝试使用自定义类加载器。我想先加密我的类文件,然后使用我的自定义类加载器加载加密的类文件,然后解密它\xe3\x80\x82
\n\n这是我的演示: https: //github.com/CaiBaohong/boot-by-custom-loader
\n\n启动时失败:
\n\nConfigServletWebServerApplicationContext : \n Exception encountered during context initialization - cancelling refresh attempt: \n org.springframework.beans.factory.UnsatisfiedDependencyException: \n Error creating bean with name \'methodValidationPostProcessor\' defined in class path resource \n [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: \n Unsatisfied dependency expressed through method \'methodValidationPostProcessor\' parameter 0; \n nested exception is \n org.springframework.beans.factory.CannotLoadBeanClassException: \n Error loading class [com.abc.bootbycustomloader.controller.UserController] \n …Run Code Online (Sandbox Code Playgroud)