로그인
메뉴
HOME
STUDY
SCS FOOD
DRAWING
MEMO
GS
DIARY
CRIZEL SLM
카테고리1
카테고리1 선택
프로그래밍
카테고리2
카테고리2 선택
AI
CSS
DB
Git
JAVA
JAVASCRIPT
MCP
mysql
NESTJS
REMIX
도커
리액트
리액트 네이티브
미들웨어
브라우저
서버
스벨트킷
스프링
스프링부트
오라클
자바
자바스크립트
플러터
제목
작성자
프로젝트를 한번 실행한 후 바로 종료하고 프로젝트 우클릭 > Run As > Run Configurations > Arguments > VM arguments 에 -Dspring.profiles.active=dev 넣기 [적용 설정] @Configuration public class DataSourceConfig { @Autowired private Environment env; @PostConstruct public void init() throws Exception { // Run Configurations > Arguments > VM arguments 에 -Dspring.profiles.active=dev 을 입력하여 개발용 properties 적용하기 String activeProfile = System.getProperty("spring.profiles.active", ""); MutablePropertySources propertySources = ((ConfigurableEnvironment) env).getPropertySources(); if (activeProfile.isEmpty()) { propertySources.addLast( new ResourcePropertySource("classpath:egovframework/egovProps/config.properties")); } else { propertySources.addLast( new ResourcePropertySource("classpath:egovframework/egovProps/config" + activeProfile + ".properties")); } } }
저장
뒤로가기