title: Spring profiles configuration
body: <p>I have a profile called "stage", I am trying to implement a web service but whenever I make a request I get some error, whenever I delete the profile annotation it works normally, I dont really know why it is not working with a profile here are some classes:</p>
  
  <pre><code>@SpringBootApplication
  public class MyApp{
  
      public static void main(String[] args) {
           AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
            context.getEnvironment().setActiveProfiles("stage");
            context.register(MyApp.class);    
            SpringApplication.run(MyApp.class, args);
  
      }
  
  }
  @Profile("stage")
  @Configuration
  @PropertySource(value = { "classpath:jdbc.properties" })
  public class StageDSConfig {
  
      @Value("${jdbc.driverClassName}")
      private String driverClassName;
      @Value("${jdbc.url}")
      private String jdbcURL;
      @Value("${jdbc.username}")
      private String username;
      @Value("${jdbc.password}")
      private String password;
  
      @Bean
      public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {
          return new PropertySourcesPlaceholderConfigurer();
      }
  
      @Bean
      public DataSource dataSource() {
  
          BasicDataSource dataSource = new BasicDataSource();
          dataSource.setDriverClassName(driverClassName);
          dataSource.setUrl(jdbcURL);
          dataSource.setUsername(username);
          dataSource.setPassword(password);
          DatabasePopulatorUtils.execute(createDatabasePopulator(), dataSource);
          return dataSource;
      }
  
      private DatabasePopulator createDatabasePopulator() {
          ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
          databasePopulator.setContinueOnError(true);
          databasePopulator.addScript(new ClassPathResource("schema-mysql.sql"));
          databasePopulator.addScript(new ClassPathResource("data-mysql.sql"));
          return databasePopulator;
      }
  }
  @EnableWs
  @Configuration
  public class WebServiceConfig extends WsConfigurerAdapter {
  
      @Bean
      public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
          MessageDispatcherServlet servlet = new MessageDispatcherServlet();
          servlet.setApplicationContext(applicationContext);
  
          servlet.setTransformWsdlLocations(true);
          return new ServletRegistrationBean(servlet, "/ws/*");
      }
  
      @Bean(name = "ws")
      public DefaultWsdl11Definition defaultActionWsdl11Definition(XsdSchema actionSchema) {
          DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
          wsdl11Definition.setPortTypeName("ActionPort");
          wsdl11Definition.setLocationUri("/ws");
          wsdl11Definition.setTargetNamespace("http://www.example.com/ws");
          wsdl11Definition.setSchema(actionSchema);
          return wsdl11Definition;
      }
  
      @Bean
      public XsdSchema wsSchema() {
          return new SimpleXsdSchema(new ClassPathResource("ws.xsd"));
      }
  
  }
  </code></pre>
  
  <p>and this is the error log:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;SOAP-ENV:Body&gt;
        &lt;SOAP-ENV:Fault&gt;
           &lt;faultcode&gt;SOAP-ENV:Server&lt;/faultcode&gt;
           &lt;faultstring xml:lang="en"&gt;PreparedStatementCallback; bad SQL grammar [INSERT INTO logs(ipAddress,actionn,requestBody) values(?,?,?)]; nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: LOGS&lt;/faultstring&gt;
        &lt;/SOAP-ENV:Fault&gt;
     &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>