I am using a scheduler with Spring technology using Quartz.
Is it possible to launch my context without creating a main class? Not using the following example:
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class App
{
public static void main( String[] args ) throws Exception
{
new ClassPathXmlApplicationContext("Spring-Quartz.xml");
}
}
For example I want my Context to be configured when I launch my jetty server.
If you launch your spring application on an application server, you can use a listener inside of the web.xml to start your spring container.
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:context.xml</param-value>
</context-param>
Another example: If you want to use spring in a blueprint OSGi environment, the blueprint extender starts all contexts in META-INF/spring or OSGI-INF/blueprint for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.