diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/CoverArtService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/CoverArtService.java index b2476535..4f49ee75 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/CoverArtService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/CoverArtService.java @@ -33,6 +33,8 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import java.io.File; import java.io.FileOutputStream; @@ -47,12 +49,16 @@ import java.util.List; * * @author Sindre Mehus */ +@Service("ajaxCoverArtService") public class CoverArtService { private static final Logger LOG = LoggerFactory.getLogger(CoverArtService.class); + @Autowired private SecurityService securityService; + @Autowired private MediaFileService mediaFileService; + @Autowired private LastFmService lastFmService; public List searchCoverArt(String artist, String album) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/LyricsService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/LyricsService.java index 153647b4..823e5af6 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/LyricsService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/LyricsService.java @@ -33,6 +33,7 @@ import org.jdom.Namespace; import org.jdom.input.SAXBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; import java.io.IOException; import java.io.StringReader; @@ -47,6 +48,7 @@ import java.net.SocketException; * * @author Sindre Mehus */ +@Service("ajaxLyricsService") public class LyricsService { private static final Logger LOG = LoggerFactory.getLogger(LyricsService.class); diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java index 4511be46..4a6fc432 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/MultiService.java @@ -30,6 +30,8 @@ import org.airsonic.player.service.SettingsService; import org.directwebremoting.WebContextFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; @@ -45,13 +47,18 @@ import java.util.List; * * @author Sindre Mehus */ +@Service("ajaxMultiService") public class MultiService { private static final Logger LOG = LoggerFactory.getLogger(MultiService.class); + @Autowired private MediaFileService mediaFileService; + @Autowired private LastFmService lastFmService; + @Autowired private SecurityService securityService; + @Autowired private SettingsService settingsService; public ArtistInfo getArtistInfo(int mediaFileId, int maxSimilarArtists, int maxTopSongs) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java index 88bf925d..100152d6 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java @@ -27,6 +27,8 @@ import org.directwebremoting.WebContext; import org.directwebremoting.WebContextFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; @@ -40,13 +42,18 @@ import java.util.List; * * @author Sindre Mehus */ +@Service("ajaxNowPlayingService") public class NowPlayingService { private static final Logger LOG = LoggerFactory.getLogger(NowPlayingService.class); + @Autowired private PlayerService playerService; + @Autowired private StatusService statusService; + @Autowired private SettingsService settingsService; + @Autowired private MediaScannerService mediaScannerService; /** diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java index 097a9181..43ba766c 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java @@ -28,6 +28,8 @@ import org.airsonic.player.service.*; import org.airsonic.player.service.PlaylistService; import org.airsonic.player.util.StringUtil; import org.directwebremoting.WebContextFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import org.springframework.web.servlet.support.RequestContextUtils; import javax.servlet.http.HttpServletRequest; @@ -41,22 +43,37 @@ import java.util.*; * * @author Sindre Mehus */ +@Service("ajaxPlayQueueService") @SuppressWarnings("UnusedDeclaration") public class PlayQueueService { + @Autowired private PlayerService playerService; + @Autowired private JukeboxService jukeboxService; + @Autowired private TranscodingService transcodingService; + @Autowired private SettingsService settingsService; + @Autowired private MediaFileService mediaFileService; + @Autowired private LastFmService lastFmService; + @Autowired private SecurityService securityService; + @Autowired private SearchService searchService; + @Autowired private RatingService ratingService; + @Autowired private PodcastService podcastService; + @Autowired private PlaylistService playlistService; + @Autowired private MediaFileDao mediaFileDao; + @Autowired private PlayQueueDao playQueueDao; + @Autowired private JWTSecurityService jwtSecurityService; /** diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/PlaylistService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/PlaylistService.java index c7135835..0ad22aef 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/PlaylistService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/PlaylistService.java @@ -30,6 +30,8 @@ import org.airsonic.player.service.PlayerService; import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; import org.directwebremoting.WebContextFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -43,14 +45,22 @@ import java.util.*; * * @author Sindre Mehus */ +@Service("ajaxPlaylistService") public class PlaylistService { + @Autowired private MediaFileService mediaFileService; + @Autowired private SecurityService securityService; + @Autowired private org.airsonic.player.service.PlaylistService playlistService; + @Autowired private MediaFileDao mediaFileDao; + @Autowired private SettingsService settingsService; + @Autowired private PlayerService playerService; + @Autowired private LocaleResolver localeResolver; public List getReadablePlaylists() { diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java index 5c9e4881..bb6658ad 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/StarService.java @@ -26,6 +26,8 @@ import org.directwebremoting.WebContext; import org.directwebremoting.WebContextFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * Provides AJAX-enabled services for starring. @@ -34,11 +36,14 @@ import org.slf4j.LoggerFactory; * * @author Sindre Mehus */ +@Service("ajaxStarService") public class StarService { private static final Logger LOG = LoggerFactory.getLogger(StarService.class); + @Autowired private SecurityService securityService; + @Autowired private MediaFileDao mediaFileDao; public void star(int id) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/TagService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/TagService.java index 7edf6f29..c5918085 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/TagService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/TagService.java @@ -29,6 +29,8 @@ import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * Provides AJAX-enabled services for editing tags in music files. @@ -36,11 +38,14 @@ import org.slf4j.LoggerFactory; * * @author Sindre Mehus */ +@Service("ajaxTagService") public class TagService { private static final Logger LOG = LoggerFactory.getLogger(TagService.class); + @Autowired private MetaDataParserFactory metaDataParserFactory; + @Autowired private MediaFileService mediaFileService; /** diff --git a/airsonic-main/src/main/java/org/airsonic/player/ajax/TransferService.java b/airsonic-main/src/main/java/org/airsonic/player/ajax/TransferService.java index 415f9529..08468d6d 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/ajax/TransferService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/ajax/TransferService.java @@ -22,15 +22,16 @@ package org.airsonic.player.ajax; import org.airsonic.player.controller.UploadController; import org.airsonic.player.domain.TransferStatus; import org.directwebremoting.WebContextFactory; +import org.springframework.stereotype.Service; import javax.servlet.http.HttpSession; - /** * Provides AJAX-enabled services for retrieving the status of ongoing transfers. * This class is used by the DWR framework (http://getahead.ltd.uk/dwr/). * * @author Sindre Mehus */ +@Service("ajaxTransferService") public class TransferService { /** diff --git a/airsonic-main/src/main/java/org/airsonic/player/i18n/LocaleResolver.java b/airsonic-main/src/main/java/org/airsonic/player/i18n/LocaleResolver.java index d7d98724..4d36a8e8 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/i18n/LocaleResolver.java +++ b/airsonic-main/src/main/java/org/airsonic/player/i18n/LocaleResolver.java @@ -22,6 +22,8 @@ package org.airsonic.player.i18n; import org.airsonic.player.domain.UserSettings; import org.airsonic.player.service.SecurityService; import org.airsonic.player.service.SettingsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -30,15 +32,17 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Locale; import java.util.Set; - /** * Locale resolver implementation which returns the locale selected in the settings. * * @author Sindre Mehus */ +@Service public class LocaleResolver implements org.springframework.web.servlet.LocaleResolver { + @Autowired private SecurityService securityService; + @Autowired private SettingsService settingsService; private Set locales; diff --git a/airsonic-main/src/main/java/org/airsonic/player/monitor/MetricsManager.java b/airsonic-main/src/main/java/org/airsonic/player/monitor/MetricsManager.java index 6ce78016..65de5a49 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/monitor/MetricsManager.java +++ b/airsonic-main/src/main/java/org/airsonic/player/monitor/MetricsManager.java @@ -4,12 +4,14 @@ import com.codahale.metrics.JmxReporter; import com.codahale.metrics.MetricRegistry; import org.airsonic.player.service.ApacheCommonsConfigurationService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import java.util.concurrent.TimeUnit; /** * Created by remi on 17/01/17. */ +@Service public class MetricsManager { @Autowired diff --git a/airsonic-main/src/main/resources/applicationContext-service.xml b/airsonic-main/src/main/resources/applicationContext-service.xml index 28fd8592..6d4b475e 100644 --- a/airsonic-main/src/main/resources/applicationContext-service.xml +++ b/airsonic-main/src/main/resources/applicationContext-service.xml @@ -11,11 +11,14 @@ - + - @@ -25,75 +28,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -