Skip to content

Commit

Permalink
add EzyExclusiveClassesConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
tvd12 committed Aug 31, 2021
1 parent fc29cda commit c0a0ac6
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.tvd12.ezyfox.bean.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
*
* @author tavandung12
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface EzyExclusiveClassesConfiguration {

Class<?>[] value();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.tvd12.ezyfox.bean.v120.testing.packet03;

import com.tvd12.ezyfox.bean.EzyBeanAutoConfig;
import com.tvd12.ezyfox.bean.EzySingletonFactory;
import com.tvd12.ezyfox.bean.EzySingletonFactoryAware;
import com.tvd12.ezyfox.bean.annotation.EzyConfigurationBefore;

import lombok.Setter;

@EzyConfigurationBefore
public class Config31 implements EzySingletonFactoryAware, EzyBeanAutoConfig {

@Setter
private EzySingletonFactory singletonFactory;

@Override
public void autoConfig() {
singletonFactory.addSingleton(new Singleton31());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.tvd12.ezyfox.bean.v120.testing.packet03;

import com.tvd12.ezyfox.bean.EzyBeanAutoConfig;
import com.tvd12.ezyfox.bean.EzySingletonFactory;
import com.tvd12.ezyfox.bean.EzySingletonFactoryAware;
import com.tvd12.ezyfox.bean.annotation.EzyConfigurationBefore;

import lombok.Setter;

@EzyConfigurationBefore
public class Config32 implements EzySingletonFactoryAware, EzyBeanAutoConfig {

@Setter
private EzySingletonFactory singletonFactory;

@Override
public void autoConfig() {
singletonFactory.addSingleton(new Singleton32());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.tvd12.ezyfox.bean.v120.testing.packet03;

import com.tvd12.ezyfox.bean.EzyBeanAutoConfig;
import com.tvd12.ezyfox.bean.annotation.EzyExclusiveClassesConfiguration;

@EzyExclusiveClassesConfiguration({Config32.class, Config32.class})
public class Config33 implements EzyBeanAutoConfig {

@Override
public void config() {
throw new RuntimeException("just test");
}

@Override
public void autoConfig() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.tvd12.ezyfox.bean.v120.testing.packet03;

import com.tvd12.ezyfox.bean.EzyBeanConfig;

public class ConfigFailed31 implements EzyBeanConfig {

@Override
public void config() {
throw new RuntimeException("just test");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.tvd12.ezyfox.bean.v120.testing.packet03;

public class Singleton31 {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.tvd12.ezyfox.bean.v120.testing.packet03;

public class Singleton32 {
}

0 comments on commit c0a0ac6

Please sign in to comment.