프로그래밍/Java

vscode 에서 devtools 정상적으로 작동하지 않을때(자동리로드 안될때)

소행성왕자 2024. 12. 13. 16:58

처음엔 자동 리로드 잘 되다가 갑자기 안되고 여러가지 설정을 셋팅해도 안될때

확장팩에 문제가 있는 듯....

 

build.gradle

plugins {
	id 'java'
	id 'war'
	id 'org.springframework.boot' version '3.1.0'
	id 'io.spring.dependency-management' version '1.1.6'
}

group = 'com.coforward'
version = '0.0.1-SNAPSHOT'

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(17)
	}
}

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.springframework.boot:spring-boot-devtools'
	// implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.0'
	implementation 'com.fasterxml.jackson.core:jackson-databind'
	implementation 'org.springframework.boot:spring-boot-starter-websocket'
	implementation 'jakarta.websocket:jakarta.websocket-api'
	compileOnly 'org.projectlombok:lombok'
	annotationProcessor 'org.projectlombok:lombok'
	//providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
	implementation 'org.springframework.boot:spring-boot-starter-tomcat'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
	// runtimeOnly 'mysql:mysql-connector-java:8.0.25'

}

tasks.named('test') {
	useJUnitPlatform()
}

application.properties

# spring.datasource.url=jdbc:mysql://localhost:3306/test
# spring.datasource.username=root
# spring.datasource.password=newpassword
# spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# mybatis.mapper-locations=classpath:/mapper/*.xml
# mybatis.type-aliases-package=com.coforward.relay.model


spring.application.name=relay

spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
spring.devtools.restart.additional-paths=src/main/java

# logging.level.root=INFO
# logging.level.com.coforward.relay.config=DEBUG

spring.thymeleaf.cache=false
spring.thymeleaf.check-template-location=true
spring.thymeleaf.enabled=true
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html

spring.output.ansi.enabled=always

 

    • Spring Boot Tools 설치
    • Language Support for Java 삭제한다.
    • >clean java 

  • cancel
  • vscode 종료후 재실행
  • main 폴더 내의 클래스 파일을 하나 연뒤 터미널 콘솔 열어 아래 명령어 입력
  • ./gradlew bootRun
  • Language Support for Java 다시 설치 restart 누르지말고 vscode 재실행