Java
-
[Spring] WebMvcConfigurerAdapter 코드 WebMvcConfigurer 으로 리팩토링하기Java/Spring 2025. 4. 29. 10:53
기존package kr.or.connect.mvcexam.config;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;import org.springframework.web.servlet.config.annotation.EnableWebMvc;import org.springframework.we..
-
[Java] try-with-resource 로 리팩토링Java/Spring 2025. 4. 28. 11:21
기존public class DataSourceTest { public static void main(String[] args) { ApplicationContext ac = new AnnotationConfigApplicationContext(ApplicationConfig.class); DataSource ds = ac.getBean(DataSource.class); Connection conn = null; try { conn = ds.getConnection(); if(conn != null) System.out.println("Connection Succeed"); } catch (Exception e) { e.printStackTrace(); } finally { ..