MNG-5683: Expand session scope so that @SessionScoped components can be injected into lifecycle participants.

This commit is contained in:
Jason van Zyl 2014-08-10 16:55:02 -07:00
parent 1ba9a6ffe0
commit 5fff038d71
1 changed files with 8 additions and 2 deletions

View File

@ -222,6 +222,14 @@ public class DefaultMaven
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) newRepositorySession( request );
MavenSession session = new MavenSession( container, repoSession, request, result );
//
// We enter the session scope right after the MavenSession creation and before any of the AbstractLifecycleParticipant lookups
// so that @SessionScoped components can be @Injected into AbstractLifecycleParticipants.
//
sessionScope.enter();
sessionScope.seed( MavenSession.class, session );
legacySupport.setSession( session );
try
@ -278,8 +286,6 @@ public class DefaultMaven
}
WorkspaceReader reactorWorkspace;
sessionScope.enter();
sessionScope.seed( MavenSession.class, session );
try
{
reactorWorkspace = container.lookup( WorkspaceReader.class, ReactorReader.HINT );