Skip to content

Commit 3d15e5d

Browse files
Profiles at Runtime
1 parent 83699f3 commit 3d15e5d

File tree

5 files changed

+82
-1
lines changed

5 files changed

+82
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package guru.springframework.bootstrap.profilesysout;
2+
3+
import org.springframework.context.annotation.Profile;
4+
import org.springframework.stereotype.Component;
5+
6+
/**
7+
* Created by jt on 5/21/16.
8+
*/
9+
@Component
10+
@Profile("default")
11+
public class DefaultProfileSysOut {
12+
13+
public DefaultProfileSysOut() {
14+
System.out.println("##################################");
15+
System.out.println("##################################");
16+
System.out.println("## DEFAULT ##");
17+
System.out.println("##################################");
18+
System.out.println("##################################");
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package guru.springframework.bootstrap.profilesysout;
2+
3+
import org.springframework.context.annotation.Profile;
4+
import org.springframework.stereotype.Component;
5+
6+
/**
7+
* Created by jt on 5/21/16.
8+
*/
9+
@Component
10+
@Profile("dev")
11+
public class DevProfileSysOut {
12+
13+
public DevProfileSysOut() {
14+
System.out.println("##################################");
15+
System.out.println("##################################");
16+
System.out.println("## DEV ##");
17+
System.out.println("##################################");
18+
System.out.println("##################################");
19+
}
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package guru.springframework.bootstrap.profilesysout;
2+
3+
import org.springframework.context.annotation.Profile;
4+
import org.springframework.stereotype.Component;
5+
6+
/**
7+
* Created by jt on 5/21/16.
8+
*/
9+
@Component
10+
@Profile("prod")
11+
public class ProdProfileSysOut {
12+
public ProdProfileSysOut() {
13+
System.out.println("##################################");
14+
System.out.println("##################################");
15+
System.out.println("## PROD ##");
16+
System.out.println("##################################");
17+
System.out.println("##################################");
18+
}
19+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package guru.springframework.bootstrap.profilesysout;
2+
3+
import org.springframework.context.annotation.Profile;
4+
import org.springframework.stereotype.Component;
5+
6+
/**
7+
* Created by jt on 5/21/16.
8+
*/
9+
@Component
10+
@Profile("qa")
11+
public class QAProfileSysOut {
12+
13+
public QAProfileSysOut() {
14+
System.out.println("##################################");
15+
System.out.println("##################################");
16+
System.out.println("## QA ##");
17+
System.out.println("##################################");
18+
System.out.println("##################################");
19+
}
20+
}

src/main/resources/application.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ spring.activemq.pooled=false
33
guru.jms.server=10.10.10.123
44
guru.jms.port=3330
55
guru.jms.user=Ron
6-
guru.jms.password=Burgundy
6+
guru.jms.password=Burgundy
7+
8+
spring.profiles.active=dev

0 commit comments

Comments
 (0)