-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from admin4j/dev
feat(version): release v0.9.7
- Loading branch information
Showing
112 changed files
with
2,692 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...-spring-web/src/main/java/com/admin4j/common/config/UserContextInitAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.admin4j.common.config; | ||
|
||
import com.admin4j.common.constant.WebConstant; | ||
import com.admin4j.common.service.IUserContextHolder; | ||
import com.admin4j.common.util.UserContextUtil; | ||
import org.springframework.beans.BeansException; | ||
import org.springframework.beans.factory.InitializingBean; | ||
import org.springframework.boot.autoconfigure.AutoConfigureOrder; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author andanyang | ||
* @since 2023/9/15 9:19 | ||
*/ | ||
@Configuration | ||
@AutoConfigureOrder(WebConstant.IUserContextHolderOrder + 8) | ||
public class UserContextInitAutoConfiguration implements InitializingBean, ApplicationContextAware { | ||
|
||
private ApplicationContext applicationContext; | ||
|
||
@Override | ||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
this.applicationContext = applicationContext; | ||
} | ||
|
||
@Override | ||
public void afterPropertiesSet() throws Exception { | ||
String[] beanNamesForType = applicationContext.getBeanNamesForType(IUserContextHolder.class); | ||
if (beanNamesForType.length > 0) { | ||
UserContextUtil.userContextHolder = applicationContext.getBean(IUserContextHolder.class); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...common-spring-web/src/main/java/com/admin4j/common/service/impl/TtlUserContextHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.admin4j.common.service.impl; | ||
|
||
import com.admin4j.common.service.IUserContextHolder; | ||
import com.alibaba.ttl.TransmittableThreadLocal; | ||
|
||
/** | ||
* 使用ttl | ||
* 当前登录用户上下文信息,可实现切换用户,切换租户。 | ||
* | ||
* @author andanyang | ||
* @since 2021/7/27 10:56 | ||
*/ | ||
public class TtlUserContextHolder extends SimpleUserContextHolder implements IUserContextHolder { | ||
|
||
public TtlUserContextHolder() { | ||
/** | ||
* 支持父子线程之间的数据传递 THREAD_LOCAL_TENANT | ||
*/ | ||
super(new TransmittableThreadLocal<>()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
admin4j-common-spring-web/src/main/resources/META-INF/spring.factories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | ||
com.admin4j.common.config.UserContextAutoConfiguration | ||
com.admin4j.common.config.UserContextAutoConfiguration, \ | ||
com.admin4j.common.config.UserContextInitAutoConfiguration | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
admin4j-common-spring/src/test/java/com/admin4j/spring/util/SpelUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.admin4j.spring.util; | ||
|
||
import junit.framework.TestCase; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.expression.spel.SpelParserConfiguration; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* @author andanyang | ||
* @since 2024/1/26 9:59 | ||
*/ | ||
public class SpelUtilTest extends TestCase { | ||
|
||
@Autowired | ||
SpelParserConfiguration spelParserConfiguration; | ||
|
||
public void testParse() throws NoSuchMethodException { | ||
|
||
// AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class); | ||
// SpelParserConfiguration bean = applicationContext.getBean(SpelParserConfiguration.class); | ||
|
||
|
||
System.out.println("spelParserConfiguration = " + spelParserConfiguration); | ||
Method[] methods = SpelUtilTest.class.getMethods(); | ||
Method tMethod = SpelUtilTest.class.getDeclaredMethod("tMethod", String.class); | ||
SpelUtilTest spelUtilTest = new SpelUtilTest(); | ||
|
||
|
||
String parse = SpelUtil.parse("'saleContract:'+#p1", tMethod, new Object[]{"param"}); | ||
System.out.println("parse = " + parse); | ||
} | ||
|
||
public String tMethod(String id) { | ||
|
||
return "p0-12"; | ||
} | ||
|
||
public void testTestParse() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.