spring boot devtools 를 사용 합 니 다.
org.springframework.boot.devtools.restart.SilentExitExceptionHandler$SilentExitException at org.springframework.boot.devtools.restart.SilentExitExceptionHandler.exitCurrentThread(SilentExitExceptionHandler.java:90) at org.springframework.boot.devtools.restart.Restarter.immediateRestart(Restarter.java:184) at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:163) at org.springframework.boot.devtools.restart.Restarter.initialize(Restarter.java:552) at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationStartingEvent(RestartApplicationListener.java:67) at org.springframework.boot.devtools.restart.RestartApplicationListener.onApplicationEvent(RestartApplicationListener.java:45) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122) at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:68) at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48) at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) at org.test.Application.main(Application.java:15)
프로젝트 의 주체 구 조 를 살 펴 보 자.대체적으로 이렇다.나 는 간소화 했다.
우선 spring boot 의 시작 입구 입 니 다:
package org.test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.Banner.Mode;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
try {
SpringApplication app = new SpringApplication(Application.class);
app.setBannerMode(Mode.OFF);
app.setWebEnvironment(false);
app.run(args);
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}
주 서 비 스 는 대체로 다음 과 같다.
package org.test;
import javax.annotation.PostConstruct;
import org.springframework.stereotype.Service;
@Service
public class MainService {
@PostConstruct
public void startServer() {
System.out.println("START");
}
}
시작 하기 만 하면 위의 오 류 를 보고 하지만 실제 적 으로 어떠한 기능 에 도 영향 을 주지 않 고 devtools 의 열 배치 기능 도 여전히 유효 합 니 다.이전 항목 을 비교 해 보 니 main()방법 에 문제 가 있 습 니 다.SpringApplication.run()은 try..catch 블록 에 넣 으 면 devtools 가 이상 하 게 던 집 니 다.main()에 있 는 try..catch 를 제거 하거나 app.run(args)이라는 문장 을 try..catch 로 옮 기거 나 catch 가 이상 할 때 printStackTrace()를 사용 하지 않 고 실행 하면 오류 로그 가 없습니다.
구체 적 인 원인 은 시간 이 나 면 원본 코드 를 뒤 져 보 세 요.spring boot 에 있어 서 시작 할 때 try..catch 는 정말 쓸데없는 짓 입 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
thymeleaf로 HTML 페이지를 동적으로 만듭니다 (spring + gradle)지난번에는 에서 화면에 HTML을 표시했습니다. 이번에는 화면을 동적으로 움직여보고 싶기 때문에 입력한 문자를 화면에 표시시키고 싶습니다. 초보자의 비망록이므로 이상한 점 등 있으면 지적 받을 수 있으면 기쁩니다! ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.