diff --git a/build.gradle b/build.gradle index 811785a..0e3501a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'org.springframework.boot' version '3.3.2' + id 'org.springframework.boot' version '3.5.6' id 'io.spring.dependency-management' version '1.1.6' } @@ -19,6 +19,19 @@ configurations { } } +// ✅ Spring Boot 실행 시 JVM 옵션 +bootRun { + jvmArgs = [ + '-Xms32g', + '-Xmx32g', + '-XX:+UseZGC', + '-XX:+ZGenerational', + '-XX:MaxMetaspaceSize=512m', + '-XX:+ZUncommit', + '-XX:ZUncommitDelay=300' + ] +} + repositories { mavenCentral() } @@ -37,6 +50,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-reactor-netty' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-webflux' + // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent + implementation 'org.springframework.boot:spring-boot-starter-parent:3.5.6' implementation 'org.springframework.retry:spring-retry:2.0.8' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0' diff --git a/sample/dev/index.html b/sample/dev/index.html index 6f97252..cc69439 100644 --- a/sample/dev/index.html +++ b/sample/dev/index.html @@ -144,9 +144,7 @@ serviceWorkerLocation: `./service-worker.js?v=1.05`, // 서비스워커 교체시 v=1.06 버전 변경 encSabun: 'h0VFCEwCVSn9SBCunLhGPWMgqQjf7h8CQ+ca7q43GRTmdr8QT1LK1uWOGZnDE6JzG/GULHGarfrOUve6qUOQAoOqOlYg2quU4Zy9bM1TG5jMH4aMp+yo5cRBXM5eJr+7oI78XE7m3pmebFZf6YEi77Xm5BtxSW436jrrOzfeEbHDDYVxOMd9Km5fOcNuLtDLDGKdhllA4w0Zv/xBfgQLJ1oC1+zo3PxGWOI5ypXDnDqUOmAldnHZEx4wM+gf7ZqHX4qiJ4tV+0baXrUuy43iA5XbnJ17s/gAk1oafG2MBL5N0n2aOJ6+367CKE2yditqEUPronrNWqwAHZiG5K8dHg==' }) - talk.run().then(() => { - console.log(1) - }) + talk.run() const startBtn = document.querySelector('#talk-start-btn'); diff --git a/sample/prod/index.html b/sample/prod/index.html index 740c7e2..a0db04b 100644 --- a/sample/prod/index.html +++ b/sample/prod/index.html @@ -142,11 +142,9 @@ activeColor: '#fff', // optional }, serviceWorkerLocation: `./service-worker.js?v=1.05`, // 서비스워커 교체시 v=1.06 버전 변경 - encSabun: 'h0VFCEwCVSn9SBCunLhGPWMgqQjf7h8CQ+ca7q43GRTmdr8QT1LK1uWOGZnDE6JzG/GULHGarfrOUve6qUOQAoOqOlYg2quU4Zy9bM1TG5jMH4aMp+yo5cRBXM5eJr+7oI78XE7m3pmebFZf6YEi77Xm5BtxSW436jrrOzfeEbHDDYVxOMd9Km5fOcNuLtDLDGKdhllA4w0Zv/xBfgQLJ1oC1+zo3PxGWOI5ypXDnDqUOmAldnHZEx4wM+gf7ZqHX4qiJ4tV+0baXrUuy43iA5XbnJ17s/gAk1oafG2MBL5N0n2aOJ6+367CKE2yditqEUPronrNWqwAHZiG5K8dHg==' - }) - talk.run().then(() => { - console.log(1) + encSabun: 'Xqx6thmfy42Jcr0rAZkN3QWpNO7o25pzU7qrXXSCjexLmubXSKHKWozgwzaOMNsIUtZKmBeQuWeMyuxV33JXvWdJ7TKdcOSjJDLFDayT5st+Kx09nyw75qH7Yt5zO/MhVYuA7Iszt8ANrI+GC5Issey4ZYo8gvNvfCkft4hEPr3mClLg7m8LZg723GJI606f8O1yNKnkIPexReeYBxAF7MYp0OvMrP6GoU4nfwwCAZyexuW+56256BtrBoPcaBPs8EFhkbrsQAUBG8TEwNM8uA0eN0DOz9iICrwoUU/Q+hWcNjkKuFenOX13E+Dx2scwKYDN0uTFjoIUpwvt2WAUvQ==' }) + talk.run() const startBtn = document.querySelector('#talk-start-btn'); diff --git a/sample/prod/talk/js/module/talkEvent.js b/sample/prod/talk/js/module/talkEvent.js index d720276..31c233e 100644 --- a/sample/prod/talk/js/module/talkEvent.js +++ b/sample/prod/talk/js/module/talkEvent.js @@ -157,10 +157,10 @@ const talkEvent = { }, // 개인 사번 구독 userSubscribe: () => { - return global.stomp.subscribe(`/exchange/user.exchange/user.${global.user.sabun}`, async function (content) { + const sessionId = talkEvent.generateTabUUID() + return global.stomp.subscribe(`/exchange/user.exchange/user.${global.user.sabun}.${sessionId}`, async function (content) { const payload = JSON.parse(content.body); if(payload.type === 'DEAD_MESSAGE') { - console.log('asdfasdfasdfasdfasdf'); global.shadowRoot.querySelector('.socket-error').classList.remove('cus-hide') } else { console.log('userSubscribe', payload) @@ -181,9 +181,9 @@ const talkEvent = { }, // 업무 구독 workSubscribe: () => { - return global.stomp.subscribe(`/exchange/work.exchange/work.${global.work.workId}`, async function (content) { + const sessionId = talkEvent.generateTabUUID() + return global.stomp.subscribe(`/exchange/work.exchange/work.${global.work.workId}.${sessionId}`, async function (content) { const payload = JSON.parse(content.body); - console.log('workSubscribe', payload) let sendFlag = false; while (!sendFlag) { if (global.serviceWorkerConnect) { diff --git a/src/main/java/com/kospo/talk/config/listener/CustomMessageListener.java b/src/main/java/com/kospo/talk/config/listener/CustomMessageListener.java index 339da25..59a6fbd 100644 --- a/src/main/java/com/kospo/talk/config/listener/CustomMessageListener.java +++ b/src/main/java/com/kospo/talk/config/listener/CustomMessageListener.java @@ -6,13 +6,8 @@ import org.springframework.context.annotation.Lazy; import org.springframework.context.event.EventListener; import org.springframework.messaging.simp.broker.SubscriptionRegistry; import org.springframework.security.core.session.SessionRegistry; -import org.springframework.web.socket.WebSocketSession; -import org.springframework.web.socket.messaging.SessionConnectedEvent; import org.springframework.web.socket.messaging.SessionDisconnectEvent; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - @Configuration @RequiredArgsConstructor public class CustomMessageListener { @@ -29,8 +24,13 @@ public class CustomMessageListener { @EventListener public void handleDisconnect(SessionDisconnectEvent event) { + System.out.println("handleDisconnect : " + event.getSessionId()); - subscriptionRegistry.unregisterAllSubscriptions(event.getSessionId()); + try { + subscriptionRegistry.unregisterAllSubscriptions(event.getSessionId()); + } catch (Exception e) { + throw new RuntimeException(e); + } sessionRegistry.removeSessionInformation(event.getSessionId()); } } diff --git a/src/main/java/com/kospo/talk/config/security/SecurityConfig.java b/src/main/java/com/kospo/talk/config/security/SecurityConfig.java index d595562..19cd190 100644 --- a/src/main/java/com/kospo/talk/config/security/SecurityConfig.java +++ b/src/main/java/com/kospo/talk/config/security/SecurityConfig.java @@ -58,7 +58,7 @@ public class SecurityConfig { CorsConfiguration config = new CorsConfiguration(); String origin = request.getHeader("Origin"); config.setAllowCredentials(true); - config.setAllowedOrigins(Arrays.asList("http://kisp.kospo.co.kr:8010", "http://localhost:8010")); + config.setAllowedOrigins(Arrays.asList("http://kisp.kospo.co.kr:8010", "http://localhost:8010", "http://talk.kospo.co.kr:3000")); config.setAllowedMethods(Arrays.asList("POST","GET","DELETE","PUT","OPTIONS")); config.setAllowedHeaders(Arrays.asList("*")); return config; diff --git a/src/main/java/com/kospo/talk/config/utils/ApplicationContextProvider.java b/src/main/java/com/kospo/talk/config/utils/ApplicationContextProvider.java new file mode 100644 index 0000000..b2a39f3 --- /dev/null +++ b/src/main/java/com/kospo/talk/config/utils/ApplicationContextProvider.java @@ -0,0 +1,25 @@ +package com.kospo.talk.config.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class ApplicationContextProvider implements ApplicationContextAware { + + private static ApplicationContext context; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + context = applicationContext; + } + + public static ApplicationContext getApplicationContext() { + return context; + } + + public static T getBean(Class beanClass) { + return context.getBean(beanClass); + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c1ad392..cfbeb5b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: dev # 운영 prod 개발 dev \ No newline at end of file + active: prod # 운영 prod 개발 dev \ No newline at end of file diff --git a/src/main/resources/logback-dev.properties b/src/main/resources/logback-dev.properties index 056a824..4b407a5 100644 --- a/src/main/resources/logback-dev.properties +++ b/src/main/resources/logback-dev.properties @@ -1,5 +1,5 @@ log.config.path=./logs/ log.config.filename=api_log -#log.level=debug -log.level=warn +log.level=debug +#log.level=warn diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 485e6c2..9946edd 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -88,7 +88,12 @@ - + + + + + +