props.put("ssl.truststore.location", "src/main/resources/ssl/kafka/***.jks");
应使用如下方式获取filepath:String filename = "/ssl/kafka/***.jks";
ClassPathResource resource = new ClassPathResource(filename);
InputStream inputStream = resource.getInputStream();
ApplicationHome applicationHome = new ApplicationHome(当前类名.class);
filePath = applicationHome.getSource().getParentFile().toString() + filename ;
File configFile = new File(filePath);
props.put("ssl.truststore.location", filePath);
建议封装成工具类使用。



