org.springframework.context.annotation.Profile.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中org.springframework.context.annotation.Profile.<init>()方法的一些代码示例,展示了Profile.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Profile.<init>()方法的具体详情如下:
包路径:org.springframework.context.annotation.Profile
类名称:Profile
方法名:<init>

Profile.<init>介绍

暂无

代码示例

代码示例来源:origin: ctripcorp/apollo

@Configuration
@Profile("ctrip")
public static class CtripMQConfiguration {
 @Bean
 public CtripMQService mqService() {
  return new CtripMQService();
 }
}

代码示例来源:origin: ctripcorp/apollo

/**
 * spring.profiles.active = ctrip
 */
@Configuration
@Profile("ctrip")
public static class CtripEmailConfiguration {
 @Bean
 public EmailService ctripEmailService() {
  return new CtripEmailService();
 }
 @Bean
 public CtripEmailRequestBuilder emailRequestBuilder() {
  return new CtripEmailRequestBuilder();
 }
}

代码示例来源:origin: spring-cloud/spring-cloud-config

@Configuration
@Profile("subversion")
class SvnRepositoryConfiguration {

  @Bean
  public SvnKitEnvironmentRepository svnKitEnvironmentRepository(SvnKitEnvironmentProperties environmentProperties,
                                  SvnEnvironmentRepositoryFactory factory) {
    return factory.build(environmentProperties);
  }
}

代码示例来源:origin: ctripcorp/apollo

@Configuration
@Profile("ctrip")
public class WebContextConfiguration {

代码示例来源:origin: spring-cloud/spring-cloud-config

@Configuration
@Profile("credhub")
class CredhubRepositoryConfiguration {

  @Bean
  public CredhubEnvironmentRepository credhubEnvironmentRepository(CredhubEnvironmentRepositoryFactory factory,
                                   CredhubEnvironmentProperties environmentProperties) {
    return factory.build(environmentProperties);
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-config

@Configuration
@Profile("vault")
class VaultRepositoryConfiguration {

  @Bean
  public VaultEnvironmentRepository vaultEnvironmentRepository(VaultEnvironmentRepositoryFactory factory,
                                 VaultEnvironmentProperties environmentProperties)
      throws Exception {
    return factory.build(environmentProperties);
  }
}

代码示例来源:origin: yu199195/hmily

@Configuration
@Profile("file")
static class FileRecoverConfiguration {
  private final ObjectSerializer objectSerializer;
  @Autowired(required = false)
  FileRecoverConfiguration(final ObjectSerializer objectSerializer) {
    this.objectSerializer = objectSerializer;
  }
  @Bean
  @Qualifier("fileTransactionRecoverService")
  public CompensationService fileTransactionRecoverService() {
    return new FileCompensationServiceImpl(objectSerializer);
  }
}

代码示例来源:origin: spring-projects/spring-data-examples

/**
 * Bootstraps Spring Data JPA in lazy mode if the {@code lazy} profile is activated.
 *
 * @author Oliver Gierke
 */
@Profile("lazy")
@Configuration
@EnableJpaRepositories(bootstrapMode = BootstrapMode.LAZY)
static class LazyRepositoryConfiguration {}

代码示例来源:origin: spring-projects/spring-data-examples

/**
   * Bootstraps Spring Data JPA in deferred mode if the {@code deferred} profile is activated.
   *
   * @author Oliver Gierke
   */
  @Profile("deferred")
  @Configuration
  @EnableJpaRepositories(bootstrapMode = BootstrapMode.DEFERRED)
  static class DeferredRepositoryConfiguration {}
}

代码示例来源:origin: spring-cloud/spring-cloud-config

@Configuration
@Profile("git")
class GitRepositoryConfiguration extends DefaultRepositoryConfiguration {
}

代码示例来源:origin: yu199195/Raincat

@Configuration
@Profile("file")
static class FileRecoverConfiguration {
  private final ObjectSerializer objectSerializer;
  @Autowired
  FileRecoverConfiguration(final ObjectSerializer objectSerializer) {
    this.objectSerializer = objectSerializer;
  }
  @Bean
  @Qualifier("fileTransactionRecoverService")
  public RecoverTransactionService fileTransactionRecoverService() {
    return new FileRecoverTransactionServiceImpl(objectSerializer);
  }
}

代码示例来源:origin: yu199195/myth

@Configuration
@Profile("file")
static class FileLogConfiguration {
  private final ObjectSerializer objectSerializer;
  @Autowired
  FileLogConfiguration(final ObjectSerializer objectSerializer) {
    this.objectSerializer = objectSerializer;
  }
  @Bean
  @Qualifier("fileLogService")
  public LogService fileLogService() {
    return new FileLogServiceImpl(objectSerializer);
  }
}

代码示例来源:origin: ctripcorp/apollo

@Order(99)
@Profile("auth")
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class SpringSecurityConfigurer extends WebSecurityConfigurerAdapter {
 public static final String USER_ROLE = "user";
 @Override
 protected void configure(HttpSecurity http) throws Exception {
  http.csrf().disable();
  http.headers().frameOptions().sameOrigin();
  http.authorizeRequests()
    .antMatchers("/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll()
    .antMatchers("/**").hasAnyRole(USER_ROLE);
  http.formLogin().loginPage("/signin").permitAll().failureUrl("/signin?#/error").and().httpBasic();
  SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler();
  urlLogoutHandler.setDefaultTargetUrl("/signin?#/logout");
  http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true)
    .logoutSuccessHandler(urlLogoutHandler);
  http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin"));
 }
}

代码示例来源:origin: spring-cloud/spring-cloud-config

@Configuration
@Profile("jdbc")
@ConditionalOnClass(JdbcTemplate.class)
class JdbcRepositoryConfiguration {

  @Bean
  @ConditionalOnBean(JdbcTemplate.class)
  public JdbcEnvironmentRepository jdbcEnvironmentRepository(JdbcEnvironmentRepositoryFactory factory,
                                JdbcEnvironmentProperties environmentProperties) {
    return factory.build(environmentProperties);
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-config

@Configuration
@ConditionalOnMissingBean(EnvironmentRepository.class)
@Profile("native")
class NativeRepositoryConfiguration {

  @Bean
  public NativeEnvironmentRepository nativeEnvironmentRepository(NativeEnvironmentRepositoryFactory factory,
      NativeEnvironmentProperties environmentProperties) {
    return factory.build(environmentProperties);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Profile(DEV_ENV_NAME)
@Configuration
class DevConfig {
  @Bean
  public Object devBean() {
    return new Object();
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Configuration
@Profile("prod")
static class ProductionConfig {
  @Bean
  public String foo() {
    return "Production Foo";
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Configuration
@Profile("prod")
static class Config {
  @Bean
  public String bar() {
    return "Prod Bar";
  }
}

代码示例来源:origin: ctripcorp/apollo

@Configuration
@Profile("auth")
static class SpringSecurityAuthAutoConfiguration {

代码示例来源:origin: rabbitmq/rabbitmq-tutorials

/**
 * @author Gary Russell
 * @author Scott Deeg
 * @author Wayne Lund
 */
@Profile({"tut1","hello-world"})
@Configuration
public class Tut1Config {

  @Bean
  public Queue hello() {
    return new Queue("hello");
  }

  @Profile("receiver")
  @Bean
  public Tut1Receiver receiver() {
    return new Tut1Receiver();
  }

  @Profile("sender")
  @Bean
  public Tut1Sender sender() {
    return new Tut1Sender();
  }

}

相关文章