Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #29

Merged
merged 56 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
082609a
Merge pull request #5 from microsphere-projects/main
mercyblitz Aug 16, 2024
0e1e0b4
Merge pull request #7 from microsphere-projects/main
mercyblitz Aug 16, 2024
a188884
Merge pull request #10 from microsphere-projects/main
mercyblitz Aug 16, 2024
6ceca5d
Merge pull request #15 from microsphere-projects/main
mercyblitz Aug 19, 2024
2e9fdd1
Update pom.xml
mercyblitz Nov 15, 2024
f92879e
Update pom.xml
mercyblitz Nov 15, 2024
da36be1
Create logback.xml
mercyblitz Nov 15, 2024
c0167d9
Create ConfigurationMetadataReader.java
mercyblitz Nov 15, 2024
644d6e9
Create ConfigurationMetadataReaderTest.java
mercyblitz Nov 15, 2024
a113f45
Update ConfigurationMetadataReader.java
mercyblitz Nov 15, 2024
edaa1e7
Create ConfigurationMetadataEndpoint.java
mercyblitz Nov 15, 2024
ad8232e
Update endpoints.properties
mercyblitz Nov 15, 2024
7388dca
Update ActuatorEndpointsAutoConfiguration.java
mercyblitz Nov 15, 2024
5f8c1fb
Update ActuatorEndpointsAutoConfigurationTest.java
mercyblitz Nov 15, 2024
b0bab74
Create ConditionalOnConfigurationProcessorPresent.java
mercyblitz Nov 15, 2024
9981ddd
Update ConfigurationMetadataEndpoint.java
mercyblitz Nov 15, 2024
02a2ba3
Update ActuatorEndpointsAutoConfiguration.java
mercyblitz Nov 15, 2024
9d2017a
Create ConfigurationPropertiesEndpoint.java
mercyblitz Nov 15, 2024
4b6f0b0
Update ConfigurationMetadataEndpoint.java
mercyblitz Nov 15, 2024
7b74c66
Update ActuatorEndpointsAutoConfiguration.java
mercyblitz Nov 15, 2024
2d63305
Create ConfigurationMetadataRepository.java
mercyblitz Nov 16, 2024
e3e5e75
Create ConfigurationMetadataRepositoryTest.java
mercyblitz Nov 16, 2024
efb6a45
Update ConfigurationMetadataRepository.java
mercyblitz Nov 16, 2024
9f0a048
Update ConfigurationMetadataEndpoint.java
mercyblitz Nov 16, 2024
925e009
Update ConfigurationPropertiesEndpoint.java
mercyblitz Nov 16, 2024
f0ce465
Update ActuatorEndpointsAutoConfiguration.java
mercyblitz Nov 16, 2024
b27631b
Update ActuatorEndpointsAutoConfigurationTest.java
mercyblitz Nov 16, 2024
9d96034
Create ConfigurationPropertyDescriptor.java
mercyblitz Nov 18, 2024
7c887f3
Update ConfigurationPropertiesEndpoint.java
mercyblitz Nov 22, 2024
ce9b5cb
Delete ConfigurationPropertyDescriptor.java
mercyblitz Nov 22, 2024
21e93af
Create ContextConfigurationPropertyDescriptor.java
mercyblitz Nov 22, 2024
d96b1c5
Update spring.factories
mercyblitz Nov 22, 2024
2134f5c
Update spring.factories
mercyblitz Nov 23, 2024
388bcbc
Create application.properties
mercyblitz Nov 24, 2024
9f91e50
Delete ConfigurationMetadataReader.java
mercyblitz Nov 24, 2024
b71d5ec
Delete ConfigurationMetadataRepository.java
mercyblitz Nov 24, 2024
0a5b64d
Delete ContextConfigurationPropertyDescriptor.java
mercyblitz Nov 24, 2024
d29cc84
Update
mercyblitz Nov 24, 2024
676daab
Create OriginTrackedConfigurationPropertyInitializer.java
mercyblitz Nov 24, 2024
5be1dda
Refactor
mercyblitz Nov 24, 2024
e632a69
Create PropertySourceLoaders.java
mercyblitz Nov 25, 2024
ac29c13
Create PropertySourceLoadersTest.java
mercyblitz Nov 25, 2024
48fa96d
Update PropertySourceLoaders.java
mercyblitz Nov 25, 2024
de9dfa3
Update PropertySourceLoadersTest.java
mercyblitz Nov 25, 2024
8d91976
Update OriginTrackedConfigurationPropertyInitializer.java
mercyblitz Nov 25, 2024
7c59a04
Update OriginTrackedConfigurationPropertyInitializer.java
mercyblitz Nov 25, 2024
1ff83ce
Update ConfigurableAutoConfigurationImportFilter.java
mercyblitz Nov 25, 2024
e057095
Update OriginTrackedConfigurationPropertyInitializer.java
mercyblitz Nov 27, 2024
6b65eaa
Polish #17
mercyblitz Jan 8, 2025
250c252
Polish #16
mercyblitz Jan 8, 2025
2a32b19
Polish #18
mercyblitz Jan 8, 2025
d1995f0
Polish #19
mercyblitz Jan 8, 2025
c1651b7
Remove ParallelPreInstantiationSingletonsBeanFactoryListener
mercyblitz Jan 8, 2025
952ab30
Update README.md
mercyblitz Jan 8, 2025
0992320
Sync dev-1.x branch code
mercyblitz Jan 9, 2025
b701aec
Merge pull request #28 from microsphere-projects/dev
mercyblitz Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
strategy:
matrix:
java: [ '17' , '21' ]
maven-profile-spring-boot: [ 'spring-boot-2.4' , 'spring-boot-2.5' , 'spring-boot-2.6' , 'spring-boot-2.7' ,
'spring-boot-3.0' , 'spring-boot-3.1' , 'spring-boot-3.2' , 'spring-boot-3.3' ]
maven-profile-spring-boot: [ 'spring-boot-3.0' , 'spring-boot-3.1' , 'spring-boot-3.2' ,
'spring-boot-3.3' , 'spring-boot-3.4' ]
steps:
- name: Checkout Source
uses: actions/checkout@v4
Expand All @@ -39,6 +39,11 @@ jobs:
--update-snapshots
--file pom.xml
-Drevision=0.0.1-SNAPSHOT
-DargLine="--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
-P${{ matrix.maven-profile-spring-boot }}
test
test
--activate-profiles test,coverage,${{ matrix.maven-profile-spring-boot }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: microsphere-projects/microsphere-spring-boot
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@ compiler/.gradle/*
.extract
.java-version

# vscode
.vscode/

# others
build.txt
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# microsphere-spring-boot
Microsphere Projects for Spring Boot
> Microsphere Projects for Spring Boot

[![Maven Build](https://github.com/microsphere-projects/microsphere-spring-boot/actions/workflows/maven-build.yml/badge.svg)](https://github.com/microsphere-projects/microsphere-spring-boot/actions/workflows/maven-build.yml)
[![Codecov](https://codecov.io/gh/microsphere-projects/microsphere-spring-boot/branch/dev/graph/badge.svg)](https://app.codecov.io/gh/microsphere-projects/microsphere-spring-boot)
![Maven](https://img.shields.io/maven-central/v/io.github.microsphere-projects/microsphere-spring-boot.svg)
![License](https://img.shields.io/github/license/microsphere-projects/microsphere-spring-boot.svg)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/microsphere-projects/microsphere-spring-boot.svg)](http://isitmaintained.com/project/microsphere-projects/microsphere-spring-boot "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/microsphere-projects/microsphere-spring-boot.svg)](http://isitmaintained.com/project/microsphere-projects/microsphere-spring-boot "Percentage of issues still open")
6 changes: 6 additions & 0 deletions microsphere-core-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
</dependency>

<!-- Testing Dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.springframework.core.env.Environment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

import java.util.LinkedHashSet;
import java.util.Set;
Expand All @@ -19,6 +17,7 @@
import static java.util.Arrays.asList;
import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableSet;
import static org.springframework.util.Assert.isInstanceOf;
import static org.springframework.util.StringUtils.collectionToCommaDelimitedString;
import static org.springframework.util.StringUtils.commaDelimitedListToSet;
import static org.springframework.util.StringUtils.hasText;
Expand Down Expand Up @@ -103,7 +102,7 @@ private static MutablePropertySources getPropertySources(Environment environment
}

private static ConfigurableEnvironment getConfigurableEnvironment(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
isInstanceOf(ConfigurableEnvironment.class, environment);
return (ConfigurableEnvironment) environment;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package io.microsphere.spring.boot.classloading;

import io.microsphere.classloading.BannedArtifactClassLoadingExecutor;
import io.microsphere.logging.Logger;
import io.microsphere.spring.boot.listener.SpringApplicationRunListenerAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationListener;
Expand All @@ -12,6 +11,8 @@

import java.util.Arrays;

import static io.microsphere.logging.LoggerFactory.getLogger;

/**
* {@link ApplicationStartingEvent ApplicationStartingEvent} {@link ApplicationListener Listener} bans
* the load of Artifacts collision class
Expand All @@ -21,7 +22,7 @@
*/
public class BannedArtifactClassLoadingListener extends SpringApplicationRunListenerAdapter implements Ordered {

private static final Logger logger = LoggerFactory.getLogger(BannedArtifactClassLoadingListener.class);
private static final Logger logger = getLogger(BannedArtifactClassLoadingListener.class);

private static final boolean artifactsBanned = Boolean.getBoolean("microsphere.artifacts.banned");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.microsphere.spring.boot.context;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.microsphere.logging.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.context.ApplicationListener;
Expand All @@ -13,6 +12,8 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;

import static io.microsphere.logging.LoggerFactory.getLogger;

/**
* Once execution {@link ApplicationPreparedEvent} {@link ApplicationListener}
*
Expand All @@ -24,7 +25,7 @@

private static Map<Class<? extends ApplicationListener>, Set<String>> listenerProcessedContextIds = new ConcurrentHashMap<>();

protected final Logger logger = LoggerFactory.getLogger(getClass());
protected final Logger logger = getLogger(getClass());

Check warning on line 28 in microsphere-core-spring-boot-starter/src/main/java/io/microsphere/spring/boot/context/OnceApplicationPreparedEventListener.java

View check run for this annotation

Codecov / codecov/patch

microsphere-core-spring-boot-starter/src/main/java/io/microsphere/spring/boot/context/OnceApplicationPreparedEventListener.java#L28

Added line #L28 was not covered by tests

private final Set<String> processedContextIds;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.util.ClassUtils;

import java.util.List;

import static java.util.Arrays.asList;
import static org.springframework.util.ClassUtils.isPresent;


/**
Expand All @@ -25,7 +25,7 @@

private static final String BOOTSTRAP_APPLICATION_LISTENER_ENABLED_PROPERTY_NAME = "spring.cloud.bootstrap.enabled";

private static final boolean BOOTSTRAP_APPLICATION_LISTENER_PRESENT = ClassUtils.isPresent(BOOTSTRAP_APPLICATION_LISTENER_CLASS_NAME, null);
private static final boolean BOOTSTRAP_APPLICATION_LISTENER_PRESENT = isPresent(BOOTSTRAP_APPLICATION_LISTENER_CLASS_NAME, null);

Check warning on line 28 in microsphere-core-spring-boot-starter/src/main/java/io/microsphere/spring/boot/context/OnceMainApplicationPreparedEventListener.java

View check run for this annotation

Codecov / codecov/patch

microsphere-core-spring-boot-starter/src/main/java/io/microsphere/spring/boot/context/OnceMainApplicationPreparedEventListener.java#L28

Added line #L28 was not covered by tests

private static final String BOOTSTRAP_CONTEXT_ID = "bootstrap";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
package io.microsphere.spring.boot.context.properties.bind;

import io.microsphere.spring.core.convert.support.ConversionServiceResolver;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.source.ConfigurationProperty;
import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.convert.ConversionService;
import org.springframework.util.ClassUtils;

import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
Expand All @@ -34,6 +32,8 @@

import static io.microsphere.spring.boot.context.properties.source.util.ConfigurationPropertyUtils.toDashedForm;
import static org.springframework.beans.BeanUtils.copyProperties;
import static org.springframework.beans.BeanUtils.getPropertyDescriptors;
import static org.springframework.util.ClassUtils.isPrimitiveOrWrapper;

/**
* The context for the bean annotated {@link ConfigurationProperties @ConfigurationProperties}
Expand Down Expand Up @@ -95,7 +95,7 @@ private void initBinding(Object bean) {

private void initBinding(Class<?> beanClass, String prefix, Map<String, String> bindingPropertyNames, String nestedPath) {
if (isCandidateClass(beanClass)) {
PropertyDescriptor[] descriptors = BeanUtils.getPropertyDescriptors(beanClass);
PropertyDescriptor[] descriptors = getPropertyDescriptors(beanClass);
int descriptorSize = descriptors.length;
for (int i = 0; i < descriptorSize; i++) {
PropertyDescriptor descriptor = descriptors[i];
Expand All @@ -117,7 +117,7 @@ private boolean isCandidateProperty(PropertyDescriptor descriptor) {
}

private boolean isCandidateClass(Class<?> beanClass) {
if (ClassUtils.isPrimitiveOrWrapper(beanClass)) {
if (isPrimitiveOrWrapper(beanClass)) {
return false;
}
if (beanClass.isInterface() || beanClass.isEnum() || beanClass.isAnnotation() || beanClass.isArray() || beanClass.isSynthetic()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
*/
package io.microsphere.spring.boot.context.properties.bind;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.microsphere.logging.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
Expand All @@ -30,17 +29,18 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.Assert;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

import static io.microsphere.logging.LoggerFactory.getLogger;
import static io.microsphere.spring.boot.context.properties.bind.util.BindUtils.isBoundProperty;
import static io.microsphere.spring.boot.context.properties.bind.util.BindUtils.isConfigurationPropertiesBean;
import static io.microsphere.spring.boot.context.properties.source.util.ConfigurationPropertyUtils.getPrefix;
import static io.microsphere.spring.boot.context.properties.util.ConfigurationPropertiesUtils.CONFIGURATION_PROPERTIES_CLASS;
import static io.microsphere.spring.boot.context.properties.util.ConfigurationPropertiesUtils.findConfigurationProperties;
import static org.springframework.util.Assert.isInstanceOf;

/**
* A {@link BindListener} implementation of {@link ConfigurationProperties @ConfigurationProperties} Bean to publish
Expand All @@ -54,7 +54,7 @@
*/
public class EventPublishingConfigurationPropertiesBeanPropertyChangedListener implements BindListener, BeanFactoryPostProcessor, ApplicationContextAware, SmartInitializingSingleton {

private final static Logger logger = LoggerFactory.getLogger(EventPublishingConfigurationPropertiesBeanPropertyChangedListener.class);
private final static Logger logger = getLogger(EventPublishingConfigurationPropertiesBeanPropertyChangedListener.class);

private static final Class<ConfigurableApplicationContext> CONFIGURABLE_APPLICATION_CONTEXT_CLASS = ConfigurableApplicationContext.class;

Expand Down Expand Up @@ -126,7 +126,7 @@ private void initConfigurationPropertiesBeanContexts(ConfigurableListableBeanFac
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
Class<ConfigurableApplicationContext> expectedType = CONFIGURABLE_APPLICATION_CONTEXT_CLASS;
Assert.isInstanceOf(expectedType, context, "The 'context' argument is not an instance of " + expectedType.getName());
isInstanceOf(expectedType, context, "The 'context' argument is not an instance of " + expectedType.getName());
this.context = expectedType.cast(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
*/
package io.microsphere.spring.boot.context.properties.metadata;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.microsphere.logging.Logger;
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
import org.springframework.boot.configurationprocessor.metadata.JsonMarshaller;
import org.springframework.context.ResourceLoaderAware;
Expand All @@ -28,6 +27,7 @@

import java.io.IOException;

import static io.microsphere.logging.LoggerFactory.getLogger;
import static org.springframework.core.io.support.ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX;

/**
Expand All @@ -38,7 +38,7 @@
*/
public class ConfigurationMetadataReader implements ResourceLoaderAware {

private final static Logger logger = LoggerFactory.getLogger(ConfigurationMetadataReader.class);
private final static Logger logger = getLogger(ConfigurationMetadataReader.class);

public static final String METADATA_PATH = CLASSPATH_ALL_URL_PREFIX + "/META-INF/spring-configuration-metadata.json";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.microsphere.spring.boot.env;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.microsphere.logging.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.context.logging.LoggingApplicationListener;
Expand All @@ -14,7 +13,6 @@
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.util.ObjectUtils;

import java.io.IOException;
import java.net.URL;
Expand All @@ -25,11 +23,13 @@
import java.util.Properties;
import java.util.Set;

import static io.microsphere.logging.LoggerFactory.getLogger;
import static io.microsphere.spring.boot.util.SpringApplicationUtils.getDefaultPropertiesResources;
import static io.microsphere.spring.boot.util.SpringApplicationUtils.getResourceLoader;
import static io.microsphere.spring.util.PropertySourcesUtils.getDefaultProperties;
import static io.microsphere.spring.util.ResourceLoaderUtils.getResourcePatternResolver;
import static io.microsphere.spring.core.env.PropertySourcesUtils.getDefaultProperties;
import static io.microsphere.spring.core.io.ResourceLoaderUtils.getResourcePatternResolver;
import static org.springframework.core.io.support.SpringFactoriesLoader.loadFactories;
import static org.springframework.util.ObjectUtils.containsElement;

/**
* Listable {@link ApplicationEnvironmentPreparedEvent} {@link ApplicationListener} Class
Expand All @@ -44,7 +44,7 @@

public static final int DEFAULT_ORDER = LoggingApplicationListener.LOWEST_PRECEDENCE - 1;

private static final Logger logger = LoggerFactory.getLogger(DefaultPropertiesApplicationListener.class);
private static final Logger logger = getLogger(DefaultPropertiesApplicationListener.class);

private int order = DEFAULT_ORDER;

Expand Down Expand Up @@ -81,7 +81,7 @@
ResourceLoader resourceLoader,
Map<String, Object> defaultProperties) {
Set<String> defaultPropertiesResources = getDefaultPropertiesResources();
logger.debug("Start loading from SpringApplicationUtils. GetDefaultPropertiesResources () 'defaultProperties resources: {}", defaultPropertiesResources);
logger.debug("Start loading from SpringApplicationUtils.loadDefaultPropertiesResources() 'defaultProperties resources: {}", defaultPropertiesResources);
loadDefaultProperties(defaultPropertiesResources, propertySourceLoaders, resourceLoader, defaultProperties);
}

Expand Down Expand Up @@ -178,7 +178,7 @@
}

private boolean matches(String fileExtension, String[] fileExtensions) {
return ObjectUtils.containsElement(fileExtensions, fileExtension);
return containsElement(fileExtensions, fileExtension);

Check warning on line 181 in microsphere-core-spring-boot-starter/src/main/java/io/microsphere/spring/boot/env/DefaultPropertiesApplicationListener.java

View check run for this annotation

Codecov / codecov/patch

microsphere-core-spring-boot-starter/src/main/java/io/microsphere/spring/boot/env/DefaultPropertiesApplicationListener.java#L181

Added line #L181 was not covered by tests
}

private String getExtension(String resourceLocation) {
Expand Down
Loading
Loading