From 9a554e968f84823a33df690c4ab6195c5042b5e5 Mon Sep 17 00:00:00 2001 From: yanglbme Date: Fri, 26 Feb 2021 19:16:07 +0800 Subject: [PATCH] style: update workflows and github actions --- .github/workflows/branch-merge.yml | 2 +- .github/workflows/prettier.yml | 2 +- .../核心处理层/Mybatis-DyanmicSqlSourcce.md | 14 +++++----- docs/Spring/JDBC/Spring-jdbc.md | 14 +++++----- docs/Spring/RMI/Spring-RMI.md | 20 ++++++------- docs/Spring/SpringMVC/SpringMVC-CROS.md | 8 +++--- docs/Spring/TX/Spring-transaction.md | 10 +++---- .../clazz/Spring-ApplicationListener.md | 4 +-- .../Spring-BeanDefinitionParserDelegate.md | 4 +-- .../clazz/Spring-BeanFactoryPostProcessor.md | 12 ++++---- docs/Spring/clazz/Spring-BeanNameGenerator.md | 2 +- .../clazz/Spring-Custom-attribute-resolver.md | 6 ++-- .../clazz/Spring-Custom-label-resolution.md | 8 +++--- docs/Spring/clazz/Spring-MessageSource.md | 2 +- docs/Spring/clazz/Spring-Property.md | 2 +- docs/Spring/clazz/Spring-beanFactory.md | 8 +++--- docs/Spring/clazz/Spring-scan.md | 6 ++-- docs/Spring/message/Spring-EnableJms.md | 10 +++---- .../Spring/message/Spring-MessageConverter.md | 12 ++++---- docs/Spring/mvc/Spring-MVC-HandlerMapping.md | 6 ++-- docs/Spring/mvc/Spring-mvc-MappingRegistry.md | 2 +- docs/SpringBoot/Spring-Boot-Run.md | 14 +++++----- .../SpringBoot-ConditionalOnBean.md | 2 +- .../SpringBoot-ConfigurationProperties.md | 26 ++++++++--------- .../SpringBoot/SpringBoot-application-load.md | 4 +-- docs/SpringBoot/SpringBoot-自动装配.md | 28 +++++++++---------- docs/nacos/nacos-discovery.md | 4 +-- 27 files changed, 116 insertions(+), 116 deletions(-) diff --git a/.github/workflows/branch-merge.yml b/.github/workflows/branch-merge.yml index 99f4082..e4c405f 100644 --- a/.github/workflows/branch-merge.yml +++ b/.github/workflows/branch-merge.yml @@ -13,5 +13,5 @@ jobs: with: github_token: ${{ github.token }} source_ref: ${{ github.ref }} - target_branch: "main" + target_branch: main commit_message_template: "[Automated] Merged {source_ref} into {target_branch}" diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 37c6004..f84c25d 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -20,6 +20,6 @@ jobs: uses: creyD/prettier_action@v3.3 with: prettier_options: --write **/*.{md} - commit_message: "style: prettify code" + commit_message: "style: prettify code or document" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/Mybatis/核心处理层/Mybatis-DyanmicSqlSourcce.md b/docs/Mybatis/核心处理层/Mybatis-DyanmicSqlSourcce.md index b7c8367..e092604 100644 --- a/docs/Mybatis/核心处理层/Mybatis-DyanmicSqlSourcce.md +++ b/docs/Mybatis/核心处理层/Mybatis-DyanmicSqlSourcce.md @@ -77,10 +77,10 @@ public class StaticTextSqlNode implements SqlNode { - `org.apache.ibatis.scripting.xmltags.DynamicContext#appendSql` - ```JAVA - public void appendSql(String sql) { - sqlBuilder.add(sql); - } + ```java + public void appendSql(String sql) { + sqlBuilder.add(sql); + } ``` - 解析`trim`标签 @@ -102,7 +102,7 @@ public class StaticTextSqlNode implements SqlNode { ![image-20191219152655746](../../../images/mybatis/image-20191219152655746.png) -```JAVA +```java @Override public boolean apply(DynamicContext context) { if (evaluator.evaluateBoolean(test, context.getBindings())) { @@ -116,7 +116,7 @@ public class StaticTextSqlNode implements SqlNode { - `evaluator.evaluateBoolean(test, context.getBindings())`方法 -```JAVA +```java /** * @param expression 判断语句,ID != null * @param parameterObject 参数列表 @@ -135,7 +135,7 @@ public class StaticTextSqlNode implements SqlNode { ``` -```JAVA +```java /** * 取值 * @param expression 判断语句,ID=NULL diff --git a/docs/Spring/JDBC/Spring-jdbc.md b/docs/Spring/JDBC/Spring-jdbc.md index a1e559a..083960f 100644 --- a/docs/Spring/JDBC/Spring-jdbc.md +++ b/docs/Spring/JDBC/Spring-jdbc.md @@ -24,7 +24,7 @@ - 实体对象 - ```JAVA + ```java public class HsLog { private Integer id; @@ -50,7 +50,7 @@ - DAO - ```JAVA + ```java public interface HsLogDao { List findAll(); @@ -61,7 +61,7 @@ - 实现类 - ```JAVA + ```java public class HsLogDaoImpl extends JdbcDaoSupport implements HsLogDao { @@ -154,7 +154,7 @@ - 运行方法 - ```JAVA + ```java public class SpringJDBCSourceCode { public static void main(String[] args) { @@ -251,7 +251,7 @@ - `org.springframework.jdbc.datasource.DataSourceUtils#releaseConnection` -```JAVA +```java public static void releaseConnection(@Nullable Connection con, @Nullable DataSource dataSource) { try { doReleaseConnection(con, dataSource); @@ -289,7 +289,7 @@ public static void doReleaseConnection(@Nullable Connection con, @Nullable DataS 链接数 -```JAVA +```java /** * Increase the reference count by one because the holder has been requested * (i.e. someone requested the resource held by it). @@ -412,7 +412,7 @@ public void setDataSource(@Nullable DataSource dataSource) { } ``` -```JAVA +```java @Override public List extractData(ResultSet rs) throws SQLException { List results = (this.rowsExpected > 0 ? new ArrayList<>(this.rowsExpected) : new ArrayList<>()); diff --git a/docs/Spring/RMI/Spring-RMI.md b/docs/Spring/RMI/Spring-RMI.md index dbe5cda..f3f5f50 100644 --- a/docs/Spring/RMI/Spring-RMI.md +++ b/docs/Spring/RMI/Spring-RMI.md @@ -525,7 +525,7 @@ public class RMIClientSourceCode { 1. 调用父类的`afterPropertiesSet`方法判断`serviceUrl`是否为空 2. 执行`prepare()`方法 -```JAVA +```java public void prepare() throws RemoteLookupFailureException { // Cache RMI stub on initialization? if (this.lookupStubOnStartup) { @@ -553,7 +553,7 @@ public class RMIClientSourceCode { #### org.springframework.remoting.rmi.RmiClientInterceptor#lookupStub -```JAVA +```java protected Remote lookupStub() throws RemoteLookupFailureException { try { Remote stub = null; @@ -625,7 +625,7 @@ protected Remote lookupStub() throws RemoteLookupFailureException { - 通过类图我们可以知道`RmiProxyFactoryBean`实现了`MethodInterceptor`,具体实现方法在`org.springframework.remoting.rmi.RmiClientInterceptor#invoke` -```JAVA +```java @Override public Object invoke(MethodInvocation invocation) throws Throwable { // 获取remote @@ -649,7 +649,7 @@ protected Remote lookupStub() throws RemoteLookupFailureException { ``` -```JAVA +```java protected Remote getStub() throws RemoteLookupFailureException { if (!this.cacheStub || (this.lookupStubOnStartup && !this.refreshStubOnConnectFailure)) { // 如果缓存stub存在直接获取,否则创建 @@ -668,7 +668,7 @@ protected Remote lookupStub() throws RemoteLookupFailureException { - `org.springframework.remoting.rmi.RmiClientInterceptor#doInvoke(org.aopalliance.intercept.MethodInvocation, org.springframework.remoting.rmi.RmiInvocationHandler)` -```JAVA +```java @Nullable protected Object doInvoke(MethodInvocation methodInvocation, RmiInvocationHandler invocationHandler) throws RemoteException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { @@ -693,7 +693,7 @@ protected Remote lookupStub() throws RemoteLookupFailureException { - `org.springframework.remoting.rmi.RmiInvocationWrapper#invoke` - ```JAVA + ```java /** * Delegates the actual invocation handling to the RMI exporter. * @@ -712,7 +712,7 @@ protected Remote lookupStub() throws RemoteLookupFailureException { - 继续跟踪`org.springframework.remoting.rmi.RmiBasedExporter#invoke` - ```JAVA + ```java @Override protected Object invoke(RemoteInvocation invocation, Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { @@ -723,7 +723,7 @@ protected Remote lookupStub() throws RemoteLookupFailureException { - 继续跟踪`org.springframework.remoting.support.RemoteInvocationBasedExporter#invoke` - ```JAVA + ```java protected Object invoke(RemoteInvocation invocation, Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { @@ -761,7 +761,7 @@ protected Remote lookupStub() throws RemoteLookupFailureException { ![image-20200226083247784](../../../images/spring/image-20200226083247784.png) -```JAVA +```java public class DefaultRemoteInvocationExecutor implements RemoteInvocationExecutor { @Override @@ -776,7 +776,7 @@ public class DefaultRemoteInvocationExecutor implements RemoteInvocationExecutor } ``` -```JAVA +```java public Object invoke(Object targetObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { diff --git a/docs/Spring/SpringMVC/SpringMVC-CROS.md b/docs/Spring/SpringMVC/SpringMVC-CROS.md index 9362252..49c598b 100644 --- a/docs/Spring/SpringMVC/SpringMVC-CROS.md +++ b/docs/Spring/SpringMVC/SpringMVC-CROS.md @@ -86,7 +86,7 @@ public class JSONController { - `org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#initCorsConfiguration` -```JAVA +```java @Override protected CorsConfiguration initCorsConfiguration(Object handler, Method method, RequestMappingInfo mappingInfo) { // 重新创建,为什么不作为参数传递: 还有别的实现方法 @@ -244,7 +244,7 @@ public class JSONController { - 实现**BeanDefinitionParser** 接口的都有一个**parse**方法直接看方法. - 通过查看我们可以知道最终目的获取 xml 标签中的属性,对 **CorsConfiguration**进行初始化,最后 Spring 中注册 -```JAVA +```java public class CorsBeanDefinitionParser implements BeanDefinitionParser { @Override @@ -341,7 +341,7 @@ public class CorsBeanDefinitionParser implements BeanDefinitionParser { - 跨域信息 -```JAVA +```java /** * 允许请求源 */ @@ -511,7 +511,7 @@ public class CorsBeanDefinitionParser implements BeanDefinitionParser { ![image-20200123093733129](../../../images/springMVC/clazz/image-20200123093733129.png) -```JAVA +```java @Override @SuppressWarnings("resource") public boolean processRequest(@Nullable CorsConfiguration config, HttpServletRequest request, diff --git a/docs/Spring/TX/Spring-transaction.md b/docs/Spring/TX/Spring-transaction.md index fabe2cd..c5c4b01 100644 --- a/docs/Spring/TX/Spring-transaction.md +++ b/docs/Spring/TX/Spring-transaction.md @@ -505,7 +505,7 @@ public class DeclarativeTransactionTest { - `tm.getTransaction` - ```JAVA + ```java @Override public final TransactionStatus getTransaction(@Nullable TransactionDefinition definition) throws TransactionException { @@ -577,7 +577,7 @@ public class DeclarativeTransactionTest { - `org.springframework.jdbc.datasource.DataSourceTransactionManager#doGetTransaction` - ```JAVA + ```java @Override protected Object doGetTransaction() { DataSourceTransactionObject txObject = new DataSourceTransactionObject(); @@ -594,7 +594,7 @@ public class DeclarativeTransactionTest { - `org.springframework.transaction.support.AbstractPlatformTransactionManager#suspend` - ```JAVA + ```java @Nullable protected final SuspendedResourcesHolder suspend(@Nullable Object transaction) throws TransactionException { @@ -642,7 +642,7 @@ public class DeclarativeTransactionTest { - `prepareTransactionInfo`简单的`new`对象并且绑定线程 - ```JAVA + ```java protected TransactionInfo prepareTransactionInfo(@Nullable PlatformTransactionManager tm, @Nullable TransactionAttribute txAttr, String joinpointIdentification, @Nullable TransactionStatus status) { @@ -1654,7 +1654,7 @@ static Object unwrapResourceIfNecessary(Object resource) { - `ScopedProxyUnwrapper.unwrapIfNecessary` - ```JAVA + ```java private static class ScopedProxyUnwrapper { public static Object unwrapIfNecessary(Object resource) { diff --git a/docs/Spring/clazz/Spring-ApplicationListener.md b/docs/Spring/clazz/Spring-ApplicationListener.md index e5da29c..159175d 100644 --- a/docs/Spring/clazz/Spring-ApplicationListener.md +++ b/docs/Spring/clazz/Spring-ApplicationListener.md @@ -30,7 +30,7 @@ public class DemoApplicationListener implements ApplicationListener { ``` -```JAVA +```java public class ListenerSourceCode { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Listener-demo.xml"); @@ -68,7 +68,7 @@ public class ListenerSourceCode { ## 注册 -```JAVA +```java protected void registerListeners() { // Register statically specified listeners first. // 读取 ApplicationListener diff --git a/docs/Spring/clazz/Spring-BeanDefinitionParserDelegate.md b/docs/Spring/clazz/Spring-BeanDefinitionParserDelegate.md index d0d1f3f..059a45c 100644 --- a/docs/Spring/clazz/Spring-BeanDefinitionParserDelegate.md +++ b/docs/Spring/clazz/Spring-BeanDefinitionParserDelegate.md @@ -399,7 +399,7 @@ public AbstractBeanDefinition parseBeanDefinitionElement( - 将 xml 标签的数据读取到内存中设置给`AbstractBeanDefinition` -```JAVA +```java public AbstractBeanDefinition parseBeanDefinitionAttributes(Element ele, String beanName, @Nullable BeanDefinition containingBean, AbstractBeanDefinition bd) { @@ -971,7 +971,7 @@ public Object parseIdRefElement(Element ele) { - `org.springframework.beans.factory.xml.BeanDefinitionParserDelegate#parseValueElement` -```JAVA +```java public Object parseValueElement(Element ele, @Nullable String defaultTypeName) { // It's a literal value. // 获取 xml 中的文本变量 diff --git a/docs/Spring/clazz/Spring-BeanFactoryPostProcessor.md b/docs/Spring/clazz/Spring-BeanFactoryPostProcessor.md index 0dfa082..2ef5a2e 100644 --- a/docs/Spring/clazz/Spring-BeanFactoryPostProcessor.md +++ b/docs/Spring/clazz/Spring-BeanFactoryPostProcessor.md @@ -80,11 +80,11 @@ public class BeanFactoryPostProcessorSourceCode { - `org.springframework.context.support.AbstractApplicationContext#refresh` - ```JAVA + ```java invokeBeanFactoryPostProcessors(beanFactory); ``` - ```JAVA + ```java protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory) { PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(beanFactory, getBeanFactoryPostProcessors()); @@ -100,7 +100,7 @@ public class BeanFactoryPostProcessorSourceCode { - `org.springframework.context.support.PostProcessorRegistrationDelegate#invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.util.List)` - ```JAVA + ```java public static void invokeBeanFactoryPostProcessors( ConfigurableListableBeanFactory beanFactory, List beanFactoryPostProcessors) { @@ -373,13 +373,13 @@ public class DemoInstantiationAwareBeanPostProcessor implements InstantiationAwa 在`org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#createBean(java.lang.String, org.springframework.beans.factory.support.RootBeanDefinition, java.lang.Object[])`中有如下代码 -```JAVA +```java Object bean = resolveBeforeInstantiation(beanName, mbdToUse); ``` - `org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#resolveBeforeInstantiation` -```JAVA +```java @Nullable protected Object resolveBeforeInstantiation(String beanName, RootBeanDefinition mbd) { Object bean = null; @@ -405,7 +405,7 @@ public class DemoInstantiationAwareBeanPostProcessor implements InstantiationAwa - `org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#applyBeanPostProcessorsBeforeInstantiation` -```JAVA +```java @Nullable protected Object applyBeanPostProcessorsBeforeInstantiation(Class beanClass, String beanName) { for (BeanPostProcessor bp : getBeanPostProcessors()) { diff --git a/docs/Spring/clazz/Spring-BeanNameGenerator.md b/docs/Spring/clazz/Spring-BeanNameGenerator.md index a66870a..97473ad 100644 --- a/docs/Spring/clazz/Spring-BeanNameGenerator.md +++ b/docs/Spring/clazz/Spring-BeanNameGenerator.md @@ -30,7 +30,7 @@ public interface BeanNameGenerator { - 调用工具类方法进行生成 -```JAVA +```java @Override public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) { return BeanDefinitionReaderUtils.generateBeanName(definition, registry); diff --git a/docs/Spring/clazz/Spring-Custom-attribute-resolver.md b/docs/Spring/clazz/Spring-Custom-attribute-resolver.md index 1480c3b..aeada5e 100644 --- a/docs/Spring/clazz/Spring-Custom-attribute-resolver.md +++ b/docs/Spring/clazz/Spring-Custom-attribute-resolver.md @@ -315,7 +315,7 @@ public class DatePropertyEditor extends PropertyEditorSupport { ![image-20200117142800671](../../../images/spring/image-20200117142800671.png) - ```JAVA + ```java @Nullable private Object convertForProperty( @Nullable Object value, String propertyName, BeanWrapper bw, TypeConverter converter) { @@ -332,7 +332,7 @@ public class DatePropertyEditor extends PropertyEditorSupport { ``` -```JAVA +```java private Object doConvertTextValue(@Nullable Object oldValue, String newTextValue, PropertyEditor editor) { try { editor.setValue(oldValue); @@ -352,7 +352,7 @@ public class DatePropertyEditor extends PropertyEditorSupport { - 调用用例编写的方法 - ```JAVA + ```java @Override public void setAsText(String text) throws IllegalArgumentException { System.out.println(text); diff --git a/docs/Spring/clazz/Spring-Custom-label-resolution.md b/docs/Spring/clazz/Spring-Custom-label-resolution.md index 02da013..84ef413 100644 --- a/docs/Spring/clazz/Spring-Custom-label-resolution.md +++ b/docs/Spring/clazz/Spring-Custom-label-resolution.md @@ -271,7 +271,7 @@ public class XSDDemo { - `org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver#getHandlerMappings`跟踪这个方法 -```JAVA +```java /** * Load the specified NamespaceHandler mappings lazily. * @@ -358,7 +358,7 @@ public class XSDDemo { ![image-20200109090456547](../../../images/spring/image-20200109090456547.png) - ```JAVA + ```java public DefaultNamespaceHandlerResolver(@Nullable ClassLoader classLoader) { this(classLoader, DEFAULT_HANDLER_MAPPINGS_LOCATION); } @@ -382,7 +382,7 @@ public class XSDDemo { ``` -```JAVA +```java /** * Load the specified NamespaceHandler mappings lazily. * @@ -628,7 +628,7 @@ public class UserNamespaceHandler extends NamespaceHandlerSupport { 执行`com.huifer.source.spring.parser.UserBeanDefinitionParser#doParse` -```JAVA +```java @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { // 获取 userName 标签属性值 diff --git a/docs/Spring/clazz/Spring-MessageSource.md b/docs/Spring/clazz/Spring-MessageSource.md index 518f894..2038b15 100644 --- a/docs/Spring/clazz/Spring-MessageSource.md +++ b/docs/Spring/clazz/Spring-MessageSource.md @@ -99,7 +99,7 @@ 2. `org.springframework.context.support.AbstractMessageSource#getMessageInternal` - ```JAVA + ```java @Nullable protected String getMessageInternal(@Nullable String code, @Nullable Object[] args, @Nullable Locale locale) { if (code == null) { diff --git a/docs/Spring/clazz/Spring-Property.md b/docs/Spring/clazz/Spring-Property.md index d2773c4..a973e18 100644 --- a/docs/Spring/clazz/Spring-Property.md +++ b/docs/Spring/clazz/Spring-Property.md @@ -92,7 +92,7 @@ public MutablePropertyValues(@Nullable PropertyValues original) { ### PropertyValue 的构造方法 -```JAVA +```java public PropertyValue(PropertyValue original) { Assert.notNull(original, "Original must not be null"); this.name = original.getName(); diff --git a/docs/Spring/clazz/Spring-beanFactory.md b/docs/Spring/clazz/Spring-beanFactory.md index 70a3887..4af43cb 100644 --- a/docs/Spring/clazz/Spring-beanFactory.md +++ b/docs/Spring/clazz/Spring-beanFactory.md @@ -529,7 +529,7 @@ protected void beforeSingletonCreation(String beanName) { - `org.springframework.beans.factory.support.FactoryBeanRegistrySupport#postProcessObjectFromFactoryBean` - ```JAVA + ```java protected Object postProcessObjectFromFactoryBean(Object object, String beanName) throws BeansException { return object; } @@ -582,7 +582,7 @@ protected void afterSingletonCreation(String beanName) { - 代码现在进入的很深了,回到 doGetBean - `org.springframework.beans.factory.support.AbstractBeanFactory#doGetBean` -```JAVA +```java protected T doGetBean(final String name, @Nullable final Class requiredType, @Nullable final Object[] args, boolean typeCheckOnly) throws BeansException { // 转换beanName @@ -1183,7 +1183,7 @@ public Object getSingleton(String beanName, ObjectFactory singletonFactory) { - 两个核心方法 -```JAVA +```java // Give BeanPostProcessors a chance to return a proxy instead of the target bean instance. Object bean = resolveBeforeInstantiation(beanName, mbdToUse); Object beanInstance = doCreateBean(beanName, mbdToUse, args); @@ -1870,7 +1870,7 @@ public void overrideDefaultEditor(Class requiredType, PropertyEditor property - `registerCustomEditor` -```JAVA +```java @Override public void registerCustomEditor(@Nullable Class requiredType, @Nullable String propertyPath, PropertyEditor propertyEditor) { if (requiredType == null && propertyPath == null) { diff --git a/docs/Spring/clazz/Spring-scan.md b/docs/Spring/clazz/Spring-scan.md index 9c814cf..1536641 100644 --- a/docs/Spring/clazz/Spring-scan.md +++ b/docs/Spring/clazz/Spring-scan.md @@ -368,7 +368,7 @@ public class DemoService { - `org.springframework.context.annotation.AnnotationBeanNameGenerator#buildDefaultBeanName(org.springframework.beans.factory.config.BeanDefinition, org.springframework.beans.factory.support.BeanDefinitionRegistry)` - `org.springframework.context.annotation.AnnotationBeanNameGenerator#buildDefaultBeanName(org.springframework.beans.factory.config.BeanDefinition)` -```JAVA +```java protected String buildDefaultBeanName(BeanDefinition definition) { // 获取bean class name String beanClassName = definition.getBeanClassName(); @@ -381,7 +381,7 @@ public class DemoService { ``` -```JAVA +```java @Configuration public class BeanConfig { @Scope(value =ConfigurableBeanFactory.SCOPE_PROTOTYPE) @@ -496,7 +496,7 @@ static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd, Anno #### org.springframework.context.annotation.AnnotationConfigUtils#applyScopedProxyMode -```JAVA +```java static BeanDefinitionHolder applyScopedProxyMode( ScopeMetadata metadata, BeanDefinitionHolder definition, BeanDefinitionRegistry registry) { diff --git a/docs/Spring/message/Spring-EnableJms.md b/docs/Spring/message/Spring-EnableJms.md index 9f52c70..877686d 100644 --- a/docs/Spring/message/Spring-EnableJms.md +++ b/docs/Spring/message/Spring-EnableJms.md @@ -59,7 +59,7 @@ public class JmsBootstrapConfiguration { #### afterSingletonsInstantiated -```JAVA +```java @Override public void afterSingletonsInstantiated() { // Remove resolved singleton classes from cache @@ -108,7 +108,7 @@ public class JmsBootstrapConfiguration { - 关注最后一行`this.registrar.afterPropertiesSet()` - ```JAVA + ```java @Override public void afterPropertiesSet() { registerAllEndpoints(); @@ -131,7 +131,7 @@ public class JmsBootstrapConfiguration { #### postProcessAfterInitialization -```JAVA +```java @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof AopInfrastructureBean || bean instanceof JmsListenerContainerFactory || @@ -169,7 +169,7 @@ public class JmsBootstrapConfiguration { ``` -```JAVA +```java protected void processJmsListener(JmsListener jmsListener, Method mostSpecificMethod, Object bean) { Method invocableMethod = AopUtils.selectInvocableMethod(mostSpecificMethod, bean.getClass()); @@ -302,7 +302,7 @@ public class JmsBootstrapConfiguration { - 关键接口`JmsListenerContainerFactory` - ```JAVA + ```java public interface JmsListenerContainerFactory { /** diff --git a/docs/Spring/message/Spring-MessageConverter.md b/docs/Spring/message/Spring-MessageConverter.md index 0f9e32b..ea90b9e 100644 --- a/docs/Spring/message/Spring-MessageConverter.md +++ b/docs/Spring/message/Spring-MessageConverter.md @@ -67,7 +67,7 @@ - 真正的转换过程 -```JAVA +```java @Override protected Object convertFromInternal(Message message, Class targetClass, @Nullable Object conversionHint) { Charset charset = getContentTypeCharset(getMimeType(message.getHeaders())); @@ -79,7 +79,7 @@ ### toMessage -```JAVA +```java @Override @Nullable public final Message toMessage(Object payload, @Nullable MessageHeaders headers) { @@ -88,7 +88,7 @@ ``` -```JAVA +```java @Override @Nullable public final Message toMessage(Object payload, @Nullable MessageHeaders headers, @Nullable Object conversionHint) { @@ -128,7 +128,7 @@ - `org.springframework.messaging.converter.StringMessageConverter#convertToInternal` - ```JAVA + ```java @Override @Nullable protected Object convertToInternal( @@ -147,7 +147,7 @@ - 创建**Message**对象 - ```JAVA + ```java @SuppressWarnings("unchecked") public static Message createMessage(@Nullable T payload, MessageHeaders messageHeaders) { Assert.notNull(payload, "Payload must not be null"); @@ -162,7 +162,7 @@ ``` - ```JAVA + ```java @SuppressWarnings("unchecked") public Message build() { if (this.originalMessage != null && !this.headerAccessor.isModified()) { diff --git a/docs/Spring/mvc/Spring-MVC-HandlerMapping.md b/docs/Spring/mvc/Spring-MVC-HandlerMapping.md index bb0eb56..877c1cf 100644 --- a/docs/Spring/mvc/Spring-MVC-HandlerMapping.md +++ b/docs/Spring/mvc/Spring-MVC-HandlerMapping.md @@ -58,7 +58,7 @@ public final HandlerExecutionChain getHandler(HttpServletRequest request) throws - `getHandlerInternal`方法是一个抽象方法 - ```JAVA + ```java @Nullable protected abstract Object getHandlerInternal(HttpServletRequest request) throws Exception; ``` @@ -346,7 +346,7 @@ public Map decodePathVariables(HttpServletRequest request, Map directPathMatches = this.mappingRegistry.getMappingsByUrl(lookupPath); ``` - ```JAVA + ```java @Nullable public List getMappingsByUrl(String urlPath) { return this.urlLookup.get(urlPath); diff --git a/docs/Spring/mvc/Spring-mvc-MappingRegistry.md b/docs/Spring/mvc/Spring-mvc-MappingRegistry.md index 0039efc..178a888 100644 --- a/docs/Spring/mvc/Spring-mvc-MappingRegistry.md +++ b/docs/Spring/mvc/Spring-mvc-MappingRegistry.md @@ -74,7 +74,7 @@ public class DemoController { - `org.springframework.web.servlet.handler.AbstractHandlerMethodMapping#registerHandlerMethod` - ```JAVA + ```java protected void registerHandlerMethod(Object handler, Method method, T mapping) { this.mappingRegistry.register(mapping, handler, method); } diff --git a/docs/SpringBoot/Spring-Boot-Run.md b/docs/SpringBoot/Spring-Boot-Run.md index f9db65b..1f08c26 100644 --- a/docs/SpringBoot/Spring-Boot-Run.md +++ b/docs/SpringBoot/Spring-Boot-Run.md @@ -263,7 +263,7 @@ private List createSpringFactoriesInstances(Class type, Class[] par - 最终输出内容类:`org.springframework.boot.SpringBootBanner` - ```JAVA + ```java class SpringBootBanner implements Banner { private static final String[] BANNER = { "", " . ____ _ __ _ _", @@ -297,7 +297,7 @@ private List createSpringFactoriesInstances(Class type, Class[] par ### createApplicationContext -```JAVA +```java protected ConfigurableApplicationContext createApplicationContext() { // 获取上下文类 Class contextClass = this.applicationContextClass; @@ -327,7 +327,7 @@ private List createSpringFactoriesInstances(Class type, Class[] par - `this.applicationContextClass` 初始化方法 -```JAVA +```java public SpringApplication(ResourceLoader resourceLoader, Class... primarySources) { this.resourceLoader = resourceLoader; Assert.notNull(primarySources, "PrimarySources must not be null"); @@ -342,7 +342,7 @@ private List createSpringFactoriesInstances(Class type, Class[] par - `org.springframework.boot.WebApplicationType#deduceFromClasspath` -```JAVA +```java static WebApplicationType deduceFromClasspath() { if (ClassUtils.isPresent(WEBFLUX_INDICATOR_CLASS, null) && !ClassUtils.isPresent(WEBMVC_INDICATOR_CLASS, null) && !ClassUtils.isPresent(JERSEY_INDICATOR_CLASS, null)) { @@ -364,7 +364,7 @@ private List createSpringFactoriesInstances(Class type, Class[] par ### prepareContext -```JAVA +```java private void prepareContext(ConfigurableApplicationContext context, ConfigurableEnvironment environment, SpringApplicationRunListeners listeners, ApplicationArguments applicationArguments, Banner printedBanner) { // 上下文中设置环境 @@ -631,7 +631,7 @@ private int load(Object source) { - 两种 runner 启动`ApplicationRunner` 和 `CommandLineRunner` -```JAVA +```java private void callRunners(ApplicationContext context, ApplicationArguments args) { List runners = new ArrayList<>(); runners.addAll(context.getBeansOfType(ApplicationRunner.class).values()); @@ -649,7 +649,7 @@ private int load(Object source) { ``` -```JAVA +```java private void callRunner(ApplicationRunner runner, ApplicationArguments args) { try { (runner).run(args); diff --git a/docs/SpringBoot/SpringBoot-ConditionalOnBean.md b/docs/SpringBoot/SpringBoot-ConditionalOnBean.md index 83b2387..2216b31 100644 --- a/docs/SpringBoot/SpringBoot-ConditionalOnBean.md +++ b/docs/SpringBoot/SpringBoot-ConditionalOnBean.md @@ -575,7 +575,7 @@ private List filter(List configurations, AutoConfigurationMetada - 在这里有一个关注点 循环方法`getAutoConfigurationImportFilters()` -```JAVA +```java protected List getAutoConfigurationImportFilters() { return SpringFactoriesLoader.loadFactories(AutoConfigurationImportFilter.class, this.beanClassLoader); } diff --git a/docs/SpringBoot/SpringBoot-ConfigurationProperties.md b/docs/SpringBoot/SpringBoot-ConfigurationProperties.md index 7868f22..124043f 100644 --- a/docs/SpringBoot/SpringBoot-ConfigurationProperties.md +++ b/docs/SpringBoot/SpringBoot-ConfigurationProperties.md @@ -20,7 +20,7 @@ ## ConfigurationPropertiesScan -```JAVA +```java @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @@ -39,7 +39,7 @@ public @interface ConfigurationPropertiesScan {} ## EnableConfigurationProperties -```JAVA +```java @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @@ -88,7 +88,7 @@ public @interface EnableConfigurationProperties { ### registerInfrastructureBeans -```JAVA +```java static void registerInfrastructureBeans(BeanDefinitionRegistry registry) { // 属性绑定后置处理器 ConfigurationPropertiesBindingPostProcessor.register(registry); @@ -102,7 +102,7 @@ public @interface EnableConfigurationProperties { #### ConfigurationPropertiesBindingPostProcessor.register(registry) -```JAVA +```java public static void register(BeanDefinitionRegistry registry) { Assert.notNull(registry, "Registry must not be null"); // 是否存在 @@ -119,7 +119,7 @@ public @interface EnableConfigurationProperties { #### ConfigurationPropertiesBeanDefinitionValidator.register(registry) -```JAVA +```java static void register(BeanDefinitionRegistry registry) { Assert.notNull(registry, "Registry must not be null"); if (!registry.containsBeanDefinition(BEAN_NAME)) { @@ -145,7 +145,7 @@ public @interface EnableConfigurationProperties { - 源码开始,先找出刚才的对象`org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration` - ```JAVA + ```java @Configuration(proxyBeanMethods = false) @AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE) @ConditionalOnClass(ServletRequest.class) @@ -158,7 +158,7 @@ public @interface EnableConfigurationProperties { public class ServletWebServerFactoryAutoConfiguration {} ``` -```JAVA +```java /** * 找出 {@link EnableConfigurationProperties} 注解标记的中的属性值,并且返回值不是void * @param metadata @@ -196,7 +196,7 @@ public @interface EnableConfigurationProperties { ### postProcessBeforeInitialization -```JAVA +```java @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { // 绑定 @@ -272,7 +272,7 @@ public @interface EnableConfigurationProperties { - `org.springframework.boot.context.properties.ConfigurationPropertiesBean#create` -```JAVA +```java private static ConfigurationPropertiesBean create(String name, Object instance, Class type, Method factory) { // 找注解 ConfigurationProperties annotation = findAnnotation(instance, type, factory, ConfigurationProperties.class); @@ -365,7 +365,7 @@ BindResult bind(ConfigurationPropertiesBean propertiesBean) { ##### findProperty -```JAVA +```java private ConfigurationProperty findProperty(ConfigurationPropertyName name, Context context) { if (name.isEmpty()) { return null; @@ -384,7 +384,7 @@ BindResult bind(ConfigurationPropertiesBean propertiesBean) { - `org.springframework.boot.context.properties.source.SpringConfigurationPropertySource#getConfigurationProperty` - ```JAVA + ```java @Override public ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name) { PropertyMapping[] mappings = getMapper().map(name); @@ -393,7 +393,7 @@ BindResult bind(ConfigurationPropertiesBean propertiesBean) { ``` - ```JAVA + ```java protected final ConfigurationProperty find(PropertyMapping[] mappings, ConfigurationPropertyName name) { for (PropertyMapping candidate : mappings) { @@ -409,7 +409,7 @@ BindResult bind(ConfigurationPropertiesBean propertiesBean) { ``` - ```JAVA + ```java private ConfigurationProperty find(PropertyMapping mapping) { // 需要读取的配置信息的key String propertySourceName = mapping.getPropertySourceName(); diff --git a/docs/SpringBoot/SpringBoot-application-load.md b/docs/SpringBoot/SpringBoot-application-load.md index 85fe34e..e8641ad 100644 --- a/docs/SpringBoot/SpringBoot-application-load.md +++ b/docs/SpringBoot/SpringBoot-application-load.md @@ -116,7 +116,7 @@ protected void addPropertySources(ConfigurableEnvironment environment, ResourceL - `org.springframework.boot.context.config.ConfigFileApplicationListener.Loader#load(org.springframework.boot.context.config.ConfigFileApplicationListener.Profile, org.springframework.boot.context.config.ConfigFileApplicationListener.DocumentFilterFactory, org.springframework.boot.context.config.ConfigFileApplicationListener.DocumentConsumer)` -```JAVA +```java private void load(Profile profile, DocumentFilterFactory filterFactory, DocumentConsumer consumer) { getSearchLocations().forEach( // 本地路径 @@ -196,7 +196,7 @@ private void load(Profile profile, DocumentFilterFactory filterFactory, Document ### asDocuments -```JAVA +```java /** * 将 {@link PropertySource} 转换成 {@link Document} * @param loaded diff --git a/docs/SpringBoot/SpringBoot-自动装配.md b/docs/SpringBoot/SpringBoot-自动装配.md index 54fd80b..049ab30 100644 --- a/docs/SpringBoot/SpringBoot-自动装配.md +++ b/docs/SpringBoot/SpringBoot-自动装配.md @@ -57,7 +57,7 @@ public @interface EnableAutoConfiguration { ## getAutoConfigurationMetadata() -```JAVA +```java @Override public void process(AnnotationMetadata annotationMetadata, DeferredImportSelector deferredImportSelector) { Assert.state(deferredImportSelector instanceof AutoConfigurationImportSelector, @@ -87,7 +87,7 @@ public @interface EnableAutoConfiguration { - `org.springframework.boot.autoconfigure.AutoConfigurationMetadataLoader#loadMetadata(java.lang.ClassLoader)` - ```JAVA + ```java static AutoConfigurationMetadata loadMetadata(ClassLoader classLoader, String path) { try { @@ -141,7 +141,7 @@ public @interface EnableAutoConfiguration { 先说注解 -```JAVA +```java @Configuration(proxyBeanMethods = false) @ConditionalOnClass(RedisOperations.class) @EnableConfigurationProperties(RedisProperties.class) @@ -155,7 +155,7 @@ public @interface EnableAutoConfiguration { - `org.springframework.boot.autoconfigure.data.redis.RedisProperties` - 部分 redis 配置属性 -```JAVA +```java @ConfigurationProperties(prefix = "spring.redis") public class RedisProperties { @@ -228,7 +228,7 @@ public class RedisProperties { ### getAutoConfigurationEntry -```JAVA +```java protected AutoConfigurationEntry getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata, AnnotationMetadata annotationMetadata) { if (!isEnabled(annotationMetadata)) { @@ -302,7 +302,7 @@ public class RedisProperties { - new 两个对象直接做数据转换,去重 -```JAVA +```java protected final List removeDuplicates(List list) { return new ArrayList<>(new LinkedHashSet<>(list)); } @@ -311,7 +311,7 @@ public class RedisProperties { ### getExclusions -```JAVA +```java protected Set getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) { Set excluded = new LinkedHashSet<>(); // 获取属性 exclude 值转换成list @@ -327,7 +327,7 @@ public class RedisProperties { ### getExcludeAutoConfigurationsProperty -```JAVA +```java private List getExcludeAutoConfigurationsProperty() { if (getEnvironment() instanceof ConfigurableEnvironment) { Binder binder = Binder.get(getEnvironment()); @@ -345,7 +345,7 @@ public class RedisProperties { - 修改启动类 - ```JAVA + ```java @SpringBootApplication(excludeName = { "org.sourcehot.service.HelloServiceAutoConfiguration" }) ``` @@ -354,7 +354,7 @@ public class RedisProperties { ### checkExcludedClasses -```JAVA +```java private void checkExcludedClasses(List configurations, Set exclusions) { List invalidExcludes = new ArrayList<>(exclusions.size()); for (String exclusion : exclusions) { @@ -377,7 +377,7 @@ public class RedisProperties { ### filter -```JAVA +```java private List filter(List configurations, AutoConfigurationMetadata autoConfigurationMetadata) { long startTime = System.nanoTime(); String[] candidates = StringUtils.toStringArray(configurations); @@ -430,7 +430,7 @@ public class RedisProperties { ### fireAutoConfigurationImportEvents -```JAVA +```java private void fireAutoConfigurationImportEvents(List configurations, Set exclusions) { // 获取自动配置的监听器列表 List listeners = getAutoConfigurationImportListeners(); @@ -456,7 +456,7 @@ public class RedisProperties { - `org.springframework.boot.autoconfigure.AutoConfigurationImportListener#onAutoConfigurationImportEvent` 在执行自动配置时触发 , 实现类只有 **`ConditionEvaluationReportAutoConfigurationImportListener`** - ```JAVA + ```java @Override public void onAutoConfigurationImportEvent(AutoConfigurationImportEvent event) { if (this.beanFactory != null) { @@ -482,7 +482,7 @@ public class RedisProperties { - 后续的一些行为相对简单,直接放个源码了. -```JAVA +```java @Override public void process(AnnotationMetadata annotationMetadata, DeferredImportSelector deferredImportSelector) { Assert.state(deferredImportSelector instanceof AutoConfigurationImportSelector, diff --git a/docs/nacos/nacos-discovery.md b/docs/nacos/nacos-discovery.md index edd1d12..feb3888 100644 --- a/docs/nacos/nacos-discovery.md +++ b/docs/nacos/nacos-discovery.md @@ -97,7 +97,7 @@ public static void registerGlobalNacosProperties(AnnotationAttributes attributes - 贴出注解上的信息 -```JAVA +```java NacosProperties globalProperties() default @NacosProperties(username = USERNAME_PLACEHOLDER, password = PASSWORD_PLACEHOLDER, endpoint = ENDPOINT_PLACEHOLDER, namespace = NAMESPACE_PLACEHOLDER, accessKey = ACCESS_KEY_PLACEHOLDER, secretKey = SECRET_KEY_PLACEHOLDER, serverAddr = SERVER_ADDR_PLACEHOLDER, contextPath = CONTEXT_PATH_PLACEHOLDER, clusterName = CLUSTER_NAME_PLACEHOLDER, encode = ENCODE_PLACEHOLDER); ``` @@ -527,7 +527,7 @@ public void createServiceIfAbsent(String namespaceId, String serviceName, boolea - 在了解 map 结构后不难理解下面这个获取 Service 的方法了 -```JAVA +```java public Service getService(String namespaceId, String serviceName) { if (serviceMap.get(namespaceId) == null) { return null;