Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems as if you have resolved the issue per your comment on your question. However, just-in-case:</p> <p>The underlying original problem is that you have only configured component scan in the servlet-context. As a result, the MyService annotation is getting processed only when the servlet context gets initialized. It is not available yet when the spring-quartz.xml is processed for the root context by the ContextLoaderListener.</p> <p>You likely want to enable component scanning in your root-context.xml if you are using annotations for your Services, etc. but filter out anything, such as Controllers, that would be picked up by the component scan in your servlet context so that you don't get duplicate initializations.</p> <p>If your services and web code share common packages names, then a common pattern is to use filters, component scanning everything except controllers in to the root context, and then scan only controllers (and servlets) in the servet context, using something like this:</p> <p>root-context.xml</p> <pre><code>&lt;context:component-scan base-package="package"&gt; &lt;context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/&gt; &lt;/context:component-scan&gt; </code></pre> <p>servlet-context.xml</p> <pre><code>&lt;context:component-scan base-package="package" use-default-filters="false"&gt; &lt;context:include-filter expression="org.springframework.stereotype.Controller" type="annotation" /&gt; &lt;/context:component-scan&gt; </code></pre> <p>Of course, there are many other options. For more info:</p> <ul> <li><a href="https://stackoverflow.com/questions/11453530/applicationcontext-not-finding-controllers-for-servlet-context">applicationContext not finding Controllers for Servlet context</a></li> <li><a href="https://stackoverflow.com/questions/3652090/difference-between-applicationcontext-xml-and-spring-servlet-xml-in-spring">Difference between applicationContext.xml and spring-servlet.xml in Spring Framework</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload