을 다시로드 한 후 jetty-maven-plugin 및 no-xml spring 구성을 실험하고 있지만 jettys 자동 클래스 재로드를 사용하는 데 문제가 있습니다. web.xml을 사용할 때 모든 것이 잘 동작했습니다.jetty-maven-plugin 503의
WebApplicationInitializer.java는
public class WebAppInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext container) {
AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
dispatcherContext.register(DispatcherModule.class);
ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/");
}
}
ApplicationModule annotated with @Configuration는 디스패처 서블릿에 대한 구성을 제공하는 기존의 web.xml을 대체합니다.
@Configuration
@EnableWebMvc
@ComponentScan("com.id.try")
public class DispatcherModule {
@Bean
public InternalResourceViewResolver internalResourceViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
return resolver;
}
}
그리고 마지막으로 내 치어 파일
종속성에 끌어 구성하려면 jetty-maven-plugin<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- Initial Config: Truncated -->
<properties>
<spring.version>3.2.3.RELEASE</spring.version>
<jetty.plugin.version>8.1.11.v20130520</jetty.plugin.version>
<java.version>1.7</java.version>
<javax.servlet-api.version>3.0.1</javax.servlet-api.version>
</properties>
<dependencies>
<!-- Dependencies Truncated: versions are above -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>1</scanIntervalSeconds>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
</project>
내가 컨트롤러에 문자열로 비유로 뭔가를 변경 한 후 다시 컴파일 할 때 문제는, 부두가로 할 것입니다
클래스를 다시로드 할 때, 변화를 감지하고 다시 시작하지만, 그것은 NullPointerException
java.lang.NullPointerException
at com.id.tryconfiguration.WebAppInitializer.onStartup(WebAppInitializer.java:18)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:180)
at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:106)
at org.eclipse.jetty.annotations.ServletContainerInitializerListener.doStart(ServletContainerInitializerListener.java:107)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:81)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:96)
at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:115)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:756)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1252)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.mortbay.jetty.plugin.JettyRunMojo.restartWebApp(JettyRunMojo.java:435)
at org.mortbay.jetty.plugin.JettyRunMojo$1.filesChanged(JettyRunMojo.java:394)
at org.eclipse.jetty.util.Scanner.reportBulkChanges(Scanner.java:691)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:551)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:403)
at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:353)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
시작한다 나는 구성 클래스를 제외한 시도 es 및 WebApplicationInitializer.java에 있지만 문제를 해결하는 데는 도움이되지 않습니다.
no-xml 및 jetty 클래스 리로더로 SpringMVC를 작동시키는 방법은 무엇입니까?