Skip to content

Commit

Permalink
assembly profile
Browse files Browse the repository at this point in the history
  • Loading branch information
vdiskg committed Dec 13, 2023
1 parent af7f56e commit c22644a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public FilterRegistrationBean<AdminServiceAuthenticationFilter> adminServiceAuth
* for apollo-assembly
*/
@Order(99)
@Profile("auth")
@Profile("assembly")
@Configuration
static class AdminServiceSecurityConfigurer extends WebSecurityConfigurerAdapter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static void main(String[] args) throws Exception {
*/
ConfigurableApplicationContext configContext =
new SpringApplicationBuilder(ConfigServiceApplication.class).parent(commonContext)
.profiles("assembly")
.sources(RefreshScope.class).run(args);
logger.info("configContext [{}] isActive: {}", configContext.getId(), configContext.isActive());

Expand All @@ -64,6 +65,7 @@ public static void main(String[] args) throws Exception {
*/
ConfigurableApplicationContext adminContext =
new SpringApplicationBuilder(AdminServiceApplication.class).parent(commonContext)
.profiles("assembly")
.sources(RefreshScope.class).run(args);
logger.info("adminContext [{}] isActive: {}" , adminContext.getId(), adminContext.isActive());

Expand All @@ -72,6 +74,7 @@ public static void main(String[] args) throws Exception {
*/
ConfigurableApplicationContext portalContext =
new SpringApplicationBuilder(PortalApplication.class).parent(commonContext)
.profiles("assembly")
.sources(RefreshScope.class).run(args);
logger.info("portalContext [{}] isActive: {}", portalContext.getId(), portalContext.isActive());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public BizDBPropertySource(final ServerConfigRepository serverConfigRepository,

@PostConstruct
public void runSqlScript() throws Exception {
if (env.acceptsProfiles(Profiles.of("h2"))) {
if (env.acceptsProfiles(Profiles.of("h2")) && !env.acceptsProfiles(Profiles.of("assembly"))) {
Resource resource = new ClassPathResource("jpa/configdb.init.h2.sql");
if (resource.exists()) {
DatabasePopulatorUtils.execute(new ResourceDatabasePopulator(resource), dataSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public PortalDBPropertySource(final ServerConfigRepository serverConfigRepositor

@PostConstruct
public void runSqlScript() throws Exception {
if (env.acceptsProfiles(Profiles.of("h2"))) {
if (env.acceptsProfiles(Profiles.of("h2")) && !env.acceptsProfiles(Profiles.of("assembly"))) {
Resource resource = new ClassPathResource("jpa/portaldb.init.h2.sql");
if (resource.exists()) {
DatabasePopulatorUtils.execute(new ResourceDatabasePopulator(resource), dataSource);
Expand Down

0 comments on commit c22644a

Please sign in to comment.