我正在玩Spring Boot 2 webflux.我正在尝试使用它ReactiveSortingRepository来简化redis操作.
public interface DataProfileRepository extends ReactiveSortingRepository<DataProfileDTO, String> {
}
Run Code Online (Sandbox Code Playgroud)
只需使用此界面即可
Mono<DataProfileDTO> tmp = this.dataProfileRepository.findById(id);
Run Code Online (Sandbox Code Playgroud)
例外:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [com.tradeshift.dgps.dto.DataProfileDTO] to type [reactor.core.publisher.Mono<?>]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:321) ~[spring-core-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:194) ~[spring-core-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:174) ~[spring-core-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at org.springframework.data.repository.util.ReactiveWrapperConverters.toWrapper(ReactiveWrapperConverters.java:197) ~[spring-data-commons-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.data.repository.core.support.QueryExecutionResultHandler.postProcessInvocationResult(QueryExecutionResultHandler.java:104) ~[spring-data-commons-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:587) ~[spring-data-commons-2.0.2.RELEASE.jar:2.0.2.RELEASE]
Run Code Online (Sandbox Code Playgroud)
被扔了.
此存储库的行为与reactor不匹配,我可以在调试模式中看到,实际DataProfileDTO是从redis获取的.尝试时失败了:
GENERIC_CONVERSION_SERVICE.convert(reactiveObject, targetWrapperType);
Run Code Online (Sandbox Code Playgroud)
在 ReactiveWrapperConverters.toWrapper
我去谷歌搜索,似乎Spring Data Redis 2.0没有提到反应式存储库支持.我想知道我的代码或Spring Data Redis 2.0中是否有任何错误,我还不支持ReactiveCrudRepository.
我在位于的EC2上安装了WordPress /var/www/html/wordpress.我按照WordPress指南将index.php和.htaccess复制到root /var/www/html,并修改了index.php并在管理面板中进行了设置.如果我只坚持默认链接,它会很好用,例如:http://www.cubcanfly.com/?p=5,但是其他永久链接选项失败,实际上所有固定链接选项.
我的.htaccess是
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
在/etc/httpd/conf/httpd.conf中
LoadModule rewrite_module modules/mod_rewrite.so
Run Code Online (Sandbox Code Playgroud)
没有评论.
提前致谢
我使用与HttpContextAccessor类似的模式
简化版如下,Console.WriteLine(SimpleStringHolder.StringValue)不应该是null。
public class SimpleStringHolder
{
private static readonly AsyncLocal<ValueHolder> CurrentHolder = new AsyncLocal<ValueHolder>();
public static string StringValue
{
get => CurrentHolder.Value?.StringValue;
set
{
var holder = CurrentHolder.Value;
if (holder != null)
{
holder.StringValue = null;
}
if (value != null)
{
CurrentHolder.Value = new ValueHolder() { StringValue = value };
}
}
}
private class ValueHolder
{
public string StringValue;
}
}
Run Code Online (Sandbox Code Playgroud)
class Program
{
private static readonly AsyncLocal<string> currentValue = new AsyncLocal<string>();
public static …Run Code Online (Sandbox Code Playgroud) .htaccess ×1
amazon-ec2 ×1
async-await ×1
c# ×1
permalinks ×1
reactive ×1
rewrite ×1
wordpress ×1