spring boot run 이후 초기에 한번 실행되는 코드
package com.innerwave.surfinn;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import com.innerwave.surfinn.business.common.AuthCacheManager;
@SpringBootApplication
@EnableCaching
public class SpringSecurityApplication {
private static final String PROPERTIES = "spring.config.location="
+"classpath:/config/application.yml"
+",classpath:/authentication-config.yml"
;
public static void main(String[] args) {
ConfigurableApplicationContext context = new SpringApplicationBuilder(SpringSecurityApplication.class)
.properties(PROPERTIES)
.run(args);
context.getBean(AuthCacheManager.class).setCacheInitial();
}
}
ConfigurableApplicationContext context = SpringApplicationBuilder..run();
context.getBean( 클래스 ).메소드()
'Framework & Library > Spring & String boot' 카테고리의 다른 글
Spring과 Spring Boot란? (0) | 2024.03.10 |
---|---|
[Spring] RestTemplate - Java에서 HTTP 통신 (0) | 2021.12.19 |
[Spring] jasypt - properties 암호화 (2) | 2021.11.09 |
[Spring] SSH 터널링(Port Forwarding) - gradle (0) | 2021.01.28 |
[Spring] ModelAndView로 파일 다운로드 (@Component, Bean 등록) (0) | 2020.12.30 |