我什么都试过了。也许有人有解决方案? 有没有办法将资源文件夹中的文件添加到项目中? Spring Boot 3.3.1 和 Spring Security 6.0。 没有什么对我有用。我需要使用资源文件夹中的图像。
您可以使用ResourceLoader:
@Autowired
private ResourceLoader resourceLoader;
...
resourceLoader.getResource("classpath:my_image.png")
图像必须位于资源文件夹的根目录中。