• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






java小兵

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2022年8月5日

Spring Boot Event 观察者模式
摘要: event 使用ApplicationEvent和ApplicationListener // event public class OrderProductEvent extends ApplicationEvent { public OrderProductEvent(Object source 阅读全文
posted @ 2022-08-05 19:47 .net一小兵 阅读(84) 评论(0) 推荐(0)
 

2022年4月5日

asp.net core MediatR
摘要: 加入MediatR包 <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="10.0.1" /> program.cs中调用AddMediatR builder.Services.A 阅读全文
posted @ 2022-04-05 18:54 .net一小兵 阅读(153) 评论(0) 推荐(0)
 

2022年2月26日

asp.net core signalR (1)
摘要: 服务端SignalR支持 // 加入signalR,需要cors支持 builder.Services.AddSignalR(); string[] urls = { "http://localhost:3000" }; builder.Services.AddCors(options => { o 阅读全文
posted @ 2022-02-26 20:44 .net一小兵 阅读(50) 评论(0) 推荐(0)
 

2022年2月22日

asp.net core 数据校验
摘要: 使用asp.net core默认的属性 public class LoginRequest { [MinLength(3)] public string Username { get; set; } [Required] public string Email { get; set; } [MinL 阅读全文
posted @ 2022-02-22 20:20 .net一小兵 阅读(150) 评论(0) 推荐(0)
 
asp.net core host service
摘要: host service public class DemoService01 { public int Add(int a, int b) { return a + b; } } // 由于Host service是单例的,所以无法使用IOC注入非单例服务 // 需要使用IServiceScope 阅读全文
posted @ 2022-02-22 18:48 .net一小兵 阅读(230) 评论(0) 推荐(0)
 

2022年2月21日

asp.net core swagger传bearer token
摘要: 在program.cs中注入swagger的Authorize支持 builder.Services.AddSwaggerGen(options => { OpenApiSecurityScheme scheme = new OpenApiSecurityScheme() { Description 阅读全文
posted @ 2022-02-21 20:20 .net一小兵 阅读(214) 评论(0) 推荐(0)
 
asp.net core 使用JWT实现认证
摘要: 用到的package <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.2" /> 定义jwt options public class JWTOptions { public 阅读全文
posted @ 2022-02-21 19:49 .net一小兵 阅读(146) 评论(0) 推荐(0)
 

2022年2月17日

asp.net core 使用Identity Framework实现账户管理
摘要: 用到的package <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.2" /> <PackageReference Include="Microsoft.Entit 阅读全文
posted @ 2022-02-17 21:21 .net一小兵 阅读(136) 评论(0) 推荐(0)
 

2022年2月15日

asp.net core middleware
摘要: 测试用中间件 // 需要安装Dynamic.Json // install-package Dynamic.Json public class CheckMiddleware { private RequestDelegate Next { get; init; } public CheckMidd 阅读全文
posted @ 2022-02-15 14:51 .net一小兵 阅读(32) 评论(0) 推荐(0)
 

2022年2月13日

asp.net core 限流filter
摘要: 限流过滤器 public class RateLimitActionFilter : IAsyncActionFilter { private IMemoryCache MemoryCache { get; init; } public RateLimitActionFilter(IMemoryCa 阅读全文
posted @ 2022-02-13 19:25 .net一小兵 阅读(76) 评论(0) 推荐(0)
 
下一页