diff --git a/ezyhttp-client/pom.xml b/ezyhttp-client/pom.xml
index 8ec01c50..e3f8d844 100644
--- a/ezyhttp-client/pom.xml
+++ b/ezyhttp-client/pom.xml
@@ -5,7 +5,7 @@
com.tvd12
ezyhttp
- 1.3.3
+ 1.3.4
ezyhttp-client
diff --git a/ezyhttp-core/pom.xml b/ezyhttp-core/pom.xml
index 8ea47ddc..73ba9488 100644
--- a/ezyhttp-core/pom.xml
+++ b/ezyhttp-core/pom.xml
@@ -5,7 +5,7 @@
com.tvd12
ezyhttp
- 1.3.3
+ 1.3.4
ezyhttp-core
diff --git a/ezyhttp-server-boot/pom.xml b/ezyhttp-server-boot/pom.xml
index d6c6631d..0a7bb88f 100644
--- a/ezyhttp-server-boot/pom.xml
+++ b/ezyhttp-server-boot/pom.xml
@@ -5,7 +5,7 @@
com.tvd12
ezyhttp
- 1.3.3
+ 1.3.4
ezyhttp-server-boot
diff --git a/ezyhttp-server-core/pom.xml b/ezyhttp-server-core/pom.xml
index 44b20fd5..91695dd9 100644
--- a/ezyhttp-server-core/pom.xml
+++ b/ezyhttp-server-core/pom.xml
@@ -5,7 +5,7 @@
com.tvd12
ezyhttp
- 1.3.3
+ 1.3.4
ezyhttp-server-core
diff --git a/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/ApplicationContextBuilder.java b/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/ApplicationContextBuilder.java
index 598a6624..1777d926 100644
--- a/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/ApplicationContextBuilder.java
+++ b/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/ApplicationContextBuilder.java
@@ -31,13 +31,7 @@
import com.tvd12.ezyhttp.core.codec.DataConverters;
import com.tvd12.ezyhttp.core.constant.HttpMethod;
import com.tvd12.ezyhttp.core.resources.ResourceDownloadManager;
-import com.tvd12.ezyhttp.server.core.annotation.ApplicationBootstrap;
-import com.tvd12.ezyhttp.server.core.annotation.ComponentClasses;
-import com.tvd12.ezyhttp.server.core.annotation.ComponentsScan;
-import com.tvd12.ezyhttp.server.core.annotation.Controller;
-import com.tvd12.ezyhttp.server.core.annotation.ExceptionHandler;
-import com.tvd12.ezyhttp.server.core.annotation.PropertiesSources;
-import com.tvd12.ezyhttp.server.core.annotation.Service;
+import com.tvd12.ezyhttp.server.core.annotation.*;
import com.tvd12.ezyhttp.server.core.asm.ExceptionHandlersImplementer;
import com.tvd12.ezyhttp.server.core.asm.RequestHandlersImplementer;
import com.tvd12.ezyhttp.server.core.constant.PropertyNames;
@@ -253,6 +247,9 @@ protected EzyBeanContext createBeanContext() {
Set bodyConverterClasses = reflection.getAnnotatedClasses(BodyConvert.class);
Set stringConverterClasses = reflection.getAnnotatedClasses(StringConvert.class);
Set bootstrapClasses = reflection.getAnnotatedClasses(ApplicationBootstrap.class);
+ Set configurationAfterApplicationReadyClasses = reflection.getAnnotatedClasses(
+ EzyConfigurationAfterApplicationReady.class
+ );
Map serviceClasses = getServiceClasses(reflection);
EzyPropertiesMap propertiesMap = getPropertiesMap(reflection);
EzyBeanContext beanContext = newBeanContextBuilder()
@@ -265,6 +262,7 @@ protected EzyBeanContext createBeanContext() {
.addSingletonClasses(bodyConverterClasses)
.addSingletonClasses(stringConverterClasses)
.addSingletonClasses(bootstrapClasses)
+ .addSingletonClasses(configurationAfterApplicationReadyClasses)
.propertiesMap(propertiesMap)
.addSingleton("systemObjectMapper", objectMapper)
.addSingleton("componentManager", componentManager)
diff --git a/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/EzyHttpApplication.java b/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/EzyHttpApplication.java
index 8ede4ab4..7b9c14f4 100644
--- a/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/EzyHttpApplication.java
+++ b/ezyhttp-server-core/src/main/java/com/tvd12/ezyhttp/server/core/EzyHttpApplication.java
@@ -1,22 +1,27 @@
package com.tvd12.ezyhttp.server.core;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
+import com.tvd12.ezyfox.bean.EzyBeanConfig;
+import com.tvd12.ezyfox.bean.EzyBeanContext;
import com.tvd12.ezyfox.util.EzyLoggable;
import com.tvd12.ezyfox.util.EzyStartable;
import com.tvd12.ezyfox.util.EzyStoppable;
import com.tvd12.ezyhttp.server.core.annotation.ApplicationBootstrap;
+import com.tvd12.ezyhttp.server.core.annotation.EzyConfigurationAfterApplicationReady;
import com.tvd12.ezyhttp.server.core.util.BannerPrinter;
-
import lombok.Getter;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static com.tvd12.ezyhttp.server.core.util.EzyConfigurationAfterApplicationReadyAnnotations.sortConfigurationAfterApplicationReadyObjects;
+
+@Getter
public class EzyHttpApplication
extends EzyLoggable
implements EzyStartable, EzyStoppable {
- @Getter
protected final ApplicationContext applicationContext;
public EzyHttpApplication(ApplicationContext applicationContext) {
@@ -42,6 +47,7 @@ public static EzyHttpApplication start(
return start(basePackage, classArray);
}
+ @SuppressWarnings("rawtypes")
public static EzyHttpApplication start(
String basePackage,
Class>... componentClasses
@@ -50,6 +56,11 @@ public static EzyHttpApplication start(
= createApplicationContext(basePackage, componentClasses);
EzyHttpApplication application = new EzyHttpApplication(applicationContext);
application.start();
+ EzyBeanContext beanContext = applicationContext.getBeanContext();
+ List configurationAfterApplicationObjects = beanContext.getSingletons(
+ EzyConfigurationAfterApplicationReady.class
+ );
+ runConfigurationAfterApplicationObjects(configurationAfterApplicationObjects);
return application;
}
@@ -90,4 +101,18 @@ protected static ApplicationContext createApplicationContext(
public void stop() {
applicationContext.destroy();
}
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ private static void runConfigurationAfterApplicationObjects(
+ List configurationAfterApplicationObjects
+ ) {
+ List