org.springframework.context.annotation.DependsOn Java Examples

The following examples show how to use org.springframework.context.annotation.DependsOn. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShiroConfig.java    From ZTuoExchange_framework with MIT License 6 votes vote down vote up
/**
 * ShiroFilterFactoryBean 处理拦截资源文件问题。
 *
 * @param securityManager
 * @return
 */

@Bean(name="shiroFilter")
@DependsOn({"securityManager"})
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
    log.info("ShiroConfiguration.shirFilter()");
    ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
    shiroFilterFactoryBean.setSecurityManager(securityManager);
    //拦截器.
    Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
    filterChainDefinitionMap.put("/captcha", "anon");
    filterChainDefinitionMap.put("/admin/code/**", "anon");
    filterChainDefinitionMap.put("admin/**/page-query", "user");
    filterChainDefinitionMap.put("/admin/employee/logout", "logout");
    filterChainDefinitionMap.put("admin/**/detail", "authc");
    shiroFilterFactoryBean.setUnauthorizedUrl("/403");
    /*shiroFilterFactoryBean.setU("/403");*/
    shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);

    return shiroFilterFactoryBean;
}
 
Example #2
Source File: ImportDataConfiguration.java    From sbp with Apache License 2.0 6 votes vote down vote up
@Bean
@ConditionalOnProperty(prefix = "spring.flyway", name = "import-data")
@DependsOn("flywayInitializer")
public FlywayDataImporter flywayDataImporter() {
    FluentConfiguration flywayConf = plugin != null
            ? Flyway.configure(plugin.getWrapper().getPluginClassLoader()) : Flyway.configure();
    flywayConf.configuration(flyway.getConfiguration());
    flywayConf.baselineVersion("0");
    flywayConf.baselineOnMigrate(true);
    flywayConf.locations("classpath:/db_data");
    flywayConf.table("_db_data");
    Flyway importDataFlyway = new Flyway(flywayConf);
    FlywayDataImporter importer = new FlywayDataImporter(importDataFlyway);
    importer.setOrder(Ordered.LOWEST_PRECEDENCE);
    return importer;
}
 
Example #3
Source File: Web3ApiService.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
/**
 * add web3j from chain and remove web3j not in chain
 * @param groupIdList
 * @throws FrontException
 */
@DependsOn("encryptType")
public void refreshWeb3jMap(List<String> groupIdList) throws FrontException {
    log.debug("refreshWeb3jMap groupIdList:{}", groupIdList);
    // if localGroupIdList not contain group in groupList from chain, add it
    groupIdList.stream()
        .filter(groupId ->
            web3jMap.get(Integer.parseInt(groupId)) == null)
        .forEach(group2Init ->
            initWeb3j(Integer.parseInt(group2Init)));

    Set<Integer> localGroupIdList = web3jMap.keySet();
    log.debug("refreshWeb3jMap localGroupList:{}", localGroupIdList);
    // if local web3j map contains group that not in groupList from chain
    // remove it from local web3j map
    localGroupIdList.stream()
        // not contains in groupList from chain
        .filter(groupId ->
            !groupIdList.contains(String.valueOf(groupId)))
        .forEach(group2Remove ->
            web3jMap.remove(group2Remove));
}
 
Example #4
Source File: ShiroConfig.java    From ZTuoExchange_framework with MIT License 6 votes vote down vote up
/**
 * ShiroFilterFactoryBean 处理拦截资源文件问题。
 *
 * @param securityManager
 * @return
 */

@Bean(name="shiroFilter")
@DependsOn({"securityManager"})
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
    log.info("ShiroConfiguration.shirFilter()");
    ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
    shiroFilterFactoryBean.setSecurityManager(securityManager);
    //拦截器.
    Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
    filterChainDefinitionMap.put("/captcha", "anon");
    filterChainDefinitionMap.put("/admin/code/**", "anon");
    filterChainDefinitionMap.put("admin/**/page-query", "user");
    filterChainDefinitionMap.put("/admin/employee/logout", "logout");
    filterChainDefinitionMap.put("admin/**/detail", "authc");
    shiroFilterFactoryBean.setUnauthorizedUrl("/403");
    /*shiroFilterFactoryBean.setU("/403");*/
    shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);

    return shiroFilterFactoryBean;
}
 
Example #5
Source File: ApplicationConfig.java    From ambari-logsearch with Apache License 2.0 6 votes vote down vote up
@Bean
@DependsOn("logFeederSecurityConfig")
@Conditional(NonCloudStorageCondition.class)
public LogSearchConfigLogFeeder logSearchConfigLogFeeder() throws Exception {
  if (logFeederProps.isUseLocalConfigs()) {
    LogSearchConfigLogFeeder logfeederConfig = LogSearchConfigFactory.createLogSearchConfigLogFeeder(
      Maps.fromProperties(logFeederProps.getProperties()),
      logFeederProps.getClusterName(),
      LogSearchConfigLogFeederLocal.class, false);
    logfeederConfig.setLogLevelFilterManager(logLevelFilterManager());
    return logfeederConfig;
  } else {
    return LogSearchConfigFactory.createLogSearchConfigLogFeeder(
      Maps.fromProperties(logFeederProps.getProperties()),
      logFeederProps.getClusterName(),
      LogSearchConfigLogFeederZK.class, false);
  }
}
 
Example #6
Source File: ShiroConfig.java    From Goku.Framework.CoreUI with MIT License 5 votes vote down vote up
/**
 * DefaultAdvisorAutoProxyCreator,Spring的一个bean,由Advisor决定对哪些类的方法进行AOP代理。
 */
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
    DefaultAdvisorAutoProxyCreator defaultAAP = new DefaultAdvisorAutoProxyCreator();
    defaultAAP.setProxyTargetClass(true);
    return defaultAAP;
}
 
Example #7
Source File: ChaosMonkeyConfiguration.java    From chaos-monkey-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("chaosMonkeyRequestScope")
@ConditionalOnClass(name = "org.springframework.data.repository.Repository")
// Creates aspects that match interfaces annotated with @Repository
public SpringRepositoryAspectJPA repositoryAspectJpa(
    ChaosMonkeyRequestScope chaosMonkeyRequestScope) {
  return new SpringRepositoryAspectJPA(chaosMonkeyRequestScope, publisher(), watcherProperties);
}
 
Example #8
Source File: AbstractIamConfiguration.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
	DefaultAdvisorAutoProxyCreator advisorCreator = new DefaultAdvisorAutoProxyCreator();
	advisorCreator.setProxyTargetClass(true);
	return advisorCreator;
}
 
Example #9
Source File: ApplicationConfig.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
@Bean
@Conditional(CloudStorageCondition.class)
@DependsOn({"cloudInputConfigHandler"})
public InputConfigUploader cloudInputConfigUploader() throws Exception {
  return new InputConfigUploader("Cloud Input Config Loader", cloudLogSearchLogFeederConfig(),
    cloudInputConfigManager(),null);
}
 
Example #10
Source File: ShiroConfig.java    From litemall with MIT License 5 votes vote down vote up
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public static DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
    DefaultAdvisorAutoProxyCreator creator = new DefaultAdvisorAutoProxyCreator();
    creator.setProxyTargetClass(true);
    return creator;
}
 
Example #11
Source File: ShiroConfig.java    From springboot-shiro with MIT License 5 votes vote down vote up
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
    DefaultAdvisorAutoProxyCreator creator = new DefaultAdvisorAutoProxyCreator();
    creator.setProxyTargetClass(true);
    return creator;
}
 
Example #12
Source File: BeansBatchConfig.java    From jump-the-queue with Apache License 2.0 5 votes vote down vote up
/**
 * This method is creating jobExplorer bean
 *
 * @return JobExplorerFactoryBean
 */
@Bean
@DependsOn("dataSource")
public JobExplorerFactoryBean jobExplorer() {

  this.jobExplorer = new JobExplorerFactoryBean();
  this.jobExplorer.setDataSource(this.dataSource);
  return this.jobExplorer;
}
 
Example #13
Source File: ShiroConfig.java    From Goku.Framework.CoreUI with MIT License 5 votes vote down vote up
/**
 * ShiroRealm,这是个自定义的认证类,继承自AuthorizingRealm,
 * 负责用户的认证和权限的处理,可以参考JdbcRealm的实现。
 */
@Bean(name = "shiroRealm")
@DependsOn("lifecycleBeanPostProcessor")
public ShiroRealm shiroRealm() {
    ShiroRealm realm = new ShiroRealm();
    realm.setCacheManager(ehCacheManager());
    return realm;
}
 
Example #14
Source File: ServerJmxConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("registry")
public ConnectorServerFactoryBean connectorServer() throws MalformedObjectNameException {
	ConnectorServerFactoryBean connectorServerFactoryBean = new ConnectorServerFactoryBean();
	connectorServerFactoryBean.setObjectName("connector:name=rmi");
	connectorServerFactoryBean.setServiceUrl("service:jmx:rmi://localhost/jndi/rmi://localhost:1099/connector");
	return connectorServerFactoryBean;
}
 
Example #15
Source File: ShiroConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * cookie 管理器
 * @return
 */
@Bean(name="cookieRememberMeManager")
@DependsOn({"simpleCookie"})
public CookieRememberMeManager getCookieRememberMeManager(SimpleCookie simpleCookie){
    CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
    cookieRememberMeManager.setCookie(simpleCookie);
    /**
     * 设置 rememberMe cookie 的密钥 ,不设置 很可能:javax.crypto.BadPaddingException: Given final block not properly padded
     */
    cookieRememberMeManager.setCipherKey(Base64.decode("2AvVhdsgUs0FSA3SDFAdag=="));
    return cookieRememberMeManager ;
}
 
Example #16
Source File: ShiroConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * @DependOn  :在初始化 defaultWebSecurityManager 实例前 强制先初始化 adminRealm ,ehCacheManager。。。。。
 * @param realm
 * @param ehCacheManager
 * @param cookieRememberMeManager
 * @return
 */

@Bean(name = "securityManager")
@DependsOn({"adminRealm","ehCacheManager","cookieRememberMeManager"})
public DefaultWebSecurityManager getDefaultWebSecurityManager(AdminRealm realm, EhCacheManager ehCacheManager,CookieRememberMeManager cookieRememberMeManager) {
    DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager();
    //设置realm.
    defaultWebSecurityManager.setRealm(realm);
    defaultWebSecurityManager.setCacheManager(ehCacheManager);
    defaultWebSecurityManager.setRememberMeManager(cookieRememberMeManager);
    return defaultWebSecurityManager;
}
 
Example #17
Source File: ShiroConfig.java    From ZTuoExchange_framework with MIT License 5 votes vote down vote up
/**
 * @DependOn  :在初始化 defaultWebSecurityManager 实例前 强制先初始化 adminRealm ,ehCacheManager。。。。。
 * @param realm
 * @param ehCacheManager
 * @param cookieRememberMeManager
 * @return
 */

@Bean(name = "securityManager")
@DependsOn({"adminRealm","ehCacheManager","cookieRememberMeManager"})
public DefaultWebSecurityManager getDefaultWebSecurityManager(AdminRealm realm, EhCacheManager ehCacheManager,CookieRememberMeManager cookieRememberMeManager) {
    DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager();
    //设置realm.
    defaultWebSecurityManager.setRealm(realm);
    defaultWebSecurityManager.setCacheManager(ehCacheManager);
    defaultWebSecurityManager.setRememberMeManager(cookieRememberMeManager);
    return defaultWebSecurityManager;
}
 
Example #18
Source File: ChaosMonkeyConfiguration.java    From chaos-monkey-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("chaosMonkeyRequestScope")
// creates aspects that match simple classes annotated with @repository
public SpringRepositoryAspectJDBC repositoryAspectJdbc(
    ChaosMonkeyRequestScope chaosMonkeyRequestScope) {
  return new SpringRepositoryAspectJDBC(chaosMonkeyRequestScope, publisher(), watcherProperties);
}
 
Example #19
Source File: RqueueListenerAutoConfig.java    From rqueue with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("rqueueConfig")
@ConditionalOnMissingBean
public RqueueMessageListenerContainer rqueueMessageListenerContainer(
    RqueueMessageHandler rqueueMessageHandler) {
  if (simpleRqueueListenerContainerFactory.getRqueueMessageHandler() == null) {
    simpleRqueueListenerContainerFactory.setRqueueMessageHandler(rqueueMessageHandler);
  }
  return simpleRqueueListenerContainerFactory.createMessageListenerContainer();
}
 
Example #20
Source File: ExampleRestApplication.java    From taskana with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
  sampleDataGenerator = new SampleDataGenerator(dataSource);
  sampleDataGenerator.generateSampleData(schemaName);
  return sampleDataGenerator;
}
 
Example #21
Source File: ExampleDocumentationApplication.java    From taskana with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("getTaskanaEngine") // generate sample data after schema was inserted
public SampleDataGenerator generateSampleData(DataSource dataSource) throws SQLException {
  sampleDataGenerator = new SampleDataGenerator(dataSource);
  sampleDataGenerator.generateSampleData(schemaName);
  return sampleDataGenerator;
}
 
Example #22
Source File: MultipleFlywayBeansMethodLevelIntegrationTest.java    From embedded-database-spring-test with Apache License 2.0 5 votes vote down vote up
@Primary
@DependsOn("flyway2")
@Bean
public Flyway flyway1(DataSource dataSource) throws Exception {
    List<String> locations = ImmutableList.of("db/migration", "db/test_migration/dependent");
    return createFlyway(dataSource, "test", locations);
}
 
Example #23
Source File: MultipleFlywayBeansClassLevelIntegrationTest.java    From embedded-database-spring-test with Apache License 2.0 5 votes vote down vote up
@Primary
@DependsOn("flyway2")
@Bean
public Flyway flyway1(DataSource dataSource) throws Exception {
    List<String> locations = ImmutableList.of("db/migration", "db/test_migration/dependent");
    return createFlyway(dataSource, "test", locations);
}
 
Example #24
Source File: FlowableConfiguration.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
@Inject
@Bean
@DependsOn("coreChangelog")
public ProcessEngine processEngine(ApplicationContext applicationContext, SpringProcessEngineConfiguration processEngineConfiguration)
    throws Exception {
    ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
    processEngineFactoryBean.setApplicationContext(applicationContext);
    processEngineFactoryBean.setProcessEngineConfiguration(processEngineConfiguration);
    return processEngineFactoryBean.getObject();
}
 
Example #25
Source File: BeansBatchConfig.java    From jump-the-queue with Apache License 2.0 5 votes vote down vote up
/**
 * This method is creating JobRegistryBeanPostProcessor
 *
 * @return JobRegistryBeanPostProcessor
 */
@Bean
@DependsOn("jobRegistry")
public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor() {

  JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
  postProcessor.setJobRegistry(this.jobRegistry);
  return postProcessor;
}
 
Example #26
Source File: BootGeodeServerApplication.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("TemperatureReadings")
IndexFactoryBean temperatureReadingTimestampIndex(GemFireCache gemfireCache) {

	IndexFactoryBean temperatureTimestampIndex = new IndexFactoryBean();

	temperatureTimestampIndex.setCache(gemfireCache);
	temperatureTimestampIndex.setExpression("timestamp");
	temperatureTimestampIndex.setFrom("/TemperatureReadings");
	temperatureTimestampIndex.setName("TemperatureReadingTimestampIdx");

	return temperatureTimestampIndex;
}
 
Example #27
Source File: ShiroFilterConfiguration.java    From wolf with MIT License 5 votes vote down vote up
@Bean
@DependsOn("lifecycleBeanPostProcessor")
public DefaultAdvisorAutoProxyCreator getAutoProxyCreator(){
    DefaultAdvisorAutoProxyCreator creator = new DefaultAdvisorAutoProxyCreator();
    creator.setProxyTargetClass(true);
    return creator;
}
 
Example #28
Source File: ShiroConfiguration.java    From wangmarket with Apache License 2.0 5 votes vote down vote up
/** 
 * EhCacheManager , 缓存管理 
 * 用户登陆成功后 , 把用户信息和权限信息缓存起来 , 然后每次用户请求时 , 放入用户的session中 , 如果不设置这个bean , 每个请求都会查询一次数据库 . 
 */ 
@Bean 
@DependsOn("lifecycleBeanPostProcessor") 
public EhCacheManager ehCacheManager() { 
  EhCacheManager em = new EhCacheManager(); 
  em.setCacheManagerConfigFile("classpath:shiro-ehcache.xml");//配置文件路径 
  return em;
}
 
Example #29
Source File: CustomAuthorizationConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Description("AuthenticationManager that will generate an authentication token unlike {PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
        CalendarService calendarService,
        PasswordEncoder passwordEncoder){
    return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}
 
Example #30
Source File: CustomAuthorizationConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Description("AuthenticationMnager that will generate an authentication token unlike {PreAuthenticatedAuthenticationProvider}")
@Bean @DependsOn({"defaultCalendarService"})
public CalendarUserAuthenticationProvider calendarUserAuthenticationProvider(
        CalendarService calendarService,
        PasswordEncoder passwordEncoder){
    return new CalendarUserAuthenticationProvider(calendarService, passwordEncoder);
}