Skip to content
Browse files

SNOWDROP-51

  • Loading branch information...
1 parent 74dfc1e commit 785fe4a43599c074edc75fe086ad0f4f5416a1f1 @mbogoevici mbogoevici committed Feb 24, 2012
View
2 pom.xml
@@ -51,7 +51,7 @@
<version.javaee>3.0.0.GA</version.javaee>
<version.xerces>2.9.1</version.xerces>
<version.aopalliance>1.0</version.aopalliance>
- <version.org.jboss.as7>7.1.0.CR1b</version.org.jboss.as7>
+ <version.org.jboss.as7>7.1.0.Final</version.org.jboss.as7>
<version.spring>2.5.6.SEC02</version.spring>
<version.org.jboss.jandex>1.0.0.Beta7</version.org.jboss.jandex>
<version.aspectj>1.6.6</version.aspectj>
View
38 ...subsystem-as7/src/main/java/org/jboss/spring/deployers/as7/SpringDependencyProcessor.java
@@ -22,6 +22,9 @@
package org.jboss.spring.deployers.as7;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
import org.jboss.as.server.deployment.Attachments;
import org.jboss.as.server.deployment.DeploymentPhaseContext;
import org.jboss.as.server.deployment.DeploymentUnit;
@@ -31,7 +34,9 @@
import org.jboss.as.server.deployment.module.ModuleSpecification;
import org.jboss.modules.Module;
import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoader;
import org.jboss.modules.filter.PathFilters;
+import org.springframework.util.ReflectionUtils;
/**
* @author Marius Bogoevici
@@ -59,7 +64,38 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
}
private ModuleDependency addDependency(ModuleIdentifier moduleIdentifier, ModuleSpecification moduleSpecification) {
- ModuleDependency moduleDependency = new ModuleDependency(Module.getBootModuleLoader(), moduleIdentifier, false, false, true);
+ ModuleDependency moduleDependency = null;
+ try {
+ // try pre-JBoss Modules 1.1.1
+ Constructor<ModuleDependency> constructor = ModuleDependency.class.getConstructor(ModuleLoader.class, ModuleIdentifier.class, boolean.class, boolean.class, boolean.class);
+ moduleDependency = constructor.newInstance(Module.getBootModuleLoader(), moduleIdentifier, false, false, true);
+ } catch (NoSuchMethodException e) {
+ // ignore
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ if (moduleDependency == null) {
+ try {
+ // try JBoss Modules 1.1.1
+ Constructor<ModuleDependency> constructor = ModuleDependency.class.getConstructor(ModuleLoader.class, ModuleIdentifier.class, boolean.class, boolean.class, boolean.class, boolean.class);
+ moduleDependency = constructor.newInstance(Module.getBootModuleLoader(), moduleIdentifier, false, false, true, true);
+ } catch (NoSuchMethodException e) {
+ // ignore
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ if (moduleDependency == null) {
+ throw new IllegalStateException("JBoss Modules incompatibility: cannot find a suitable constructor for ModuleDependency");
+ }
moduleDependency.addExportFilter(PathFilters.acceptAll(), true);
moduleDependency.addImportFilter(PathFilters.acceptAll(), true);
moduleSpecification.addUserDependency(moduleDependency);
View
2 ...em-as7/subsystem-as7/src/main/java/org/jboss/spring/deployers/as7/SpringSubsystemAdd.java
@@ -52,7 +52,7 @@ protected void performBoottime(OperationContext operationContext, ModelNode mode
log.info("Activating Spring Deployer subsystem");
operationContext.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget bootContext) {
- bootContext.addDeploymentProcessor(Phase.PARSE, Phase.STRUCTURE_JBOSS_DEPLOYMENT_STRUCTURE_DESCRIPTOR + 1, new SpringStructureProcessor());
+ bootContext.addDeploymentProcessor(Phase.STRUCTURE, Phase.STRUCTURE_JBOSS_DEPLOYMENT_STRUCTURE_DESCRIPTOR + 1, new SpringStructureProcessor());
bootContext.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_DEPENDENCIES_MANIFEST, new SpringDependencyProcessor());
bootContext.addDeploymentProcessor(Phase.INSTALL, Integer.MAX_VALUE, new SpringBootstrapProcessor());
}

0 comments on commit 785fe4a

Please sign in to comment.
Something went wrong with that request. Please try again.