if(applicationContext.containsBean("custom_mediaService")){
return (MediaService)applicationContext.getBean("custom_mediaService");
}
DefaultMediaService defaultMediaService = new DefaultMediaService();
String imgDir = env.getProperty("media.imageDir");
String imgBaseUrl = env.getProperty("media.imageBaseUrl", "/files/images");
defaultMediaService.setImageDir(getDefaultFilePath(imgDir, imgBaseUrl));
defaultMediaService.setImageBaseUrl(getWebPath(imgBaseUrl));
String thumbDir = env.getProperty("media.thumbnailDir");
String thumbBaseUrl = env.getProperty("media.thumbnailBaseUrl", "/files/images/thumbnails");
defaultMediaService.setThumbnailDir(getDefaultFilePath(thumbDir, thumbBaseUrl));
defaultMediaService.setThumbnailBaseUrl(getWebPath(thumbBaseUrl));
return defaultMediaService;
}