title: How to control order of deployment (EJB first and then MBeans deployment) in Wildfly 8.2.0 AS
body: <p>I am migrating an EAR application containing MBeans from <code>JBoss 6 AS</code> to <code>Wildfly 8.2.0 AS</code>. In my EAR application, MBeans depend on EJB before initialization. </p>
  
  <p>In <code>JBoss 6 AS</code>, <code>@DependsOn</code> annotation used in MBean maintained the sequence of the deployment i.e. Dependent EJB gets deployed and then, MBean gets deployed.</p>
  
  <p>In <code>Wildfly 8.2.0</code>, I am trying to implement the same and <code>@DependsOn</code> is not working.</p>
  
  <p>I tried the below in <code>jboss-service.xml</code> to have MBeans deployed only after the deployment of <code>EAR</code> file but this did not happen.</p>
  
  <pre><code> &lt;mbean code="sample.HelloWorldService" name="sample:service=HelloWorld,id=1"&gt;
      &lt;depends&gt;jboss.j2ee:service=EARDeployment,url='application.ear'&lt;/depends&gt;
  &lt;/mbean&gt;
  </code></pre>
  
  <p>I also tried <code>@startup</code> in EJB but I cannot control the sequence i.e. 1. EJB deployment 2. MBeans deployment.</p>
  
  <p>Can anyone please help about how to control the order of deployment in <code>Wildfly 8.2.0</code>. I need to deploy EJB first and then MBeans. Many thanks.</p>