小编Ket*_*tan的帖子

如何使用FluentScheduler库在C#中安排任务?

我试图通过控制台应用程序(.Net Framework 4.5.2)熟悉C#FluentScheduler库.以下是编写的代码:

class Program
{
    static void Main(string[] args)
    {
        JobManager.Initialize(new MyRegistry());
    }
}


public class MyRegistry : Registry
{
    public MyRegistry()
    {
        Action someMethod = new Action(() =>
        {
            Console.WriteLine("Timed Task - Will run now");
        });

        Schedule schedule = new Schedule(someMethod);

        schedule.ToRunNow();


    }
}
Run Code Online (Sandbox Code Playgroud)

此代码执行时没有任何错误,但我没有看到任何在Console上写的内容.我在这里错过了什么吗?

c# fluentscheduler

7
推荐指数
2
解决办法
8474
查看次数

为什么 Spring boot Security 基本身份验证很慢?

我有一个 Spring boot 2.0.1 服务,我向其中添加了使用 BCrypt 进行哈希处理的基本身份验证。但这项服务在添加基本身份验证之前平均需要 400 毫秒,现在需要 1 秒以上。我正在使用用户详细信息服务,它在哈希映射中查找发送的用户名并返回用户详细信息。我尝试将 BCrypt 轮数减少到 4,但这并没有产生太大影响。

早些时候,我启用了无状态身份验证,后来将其禁用,但性能仍然很差。该服务托管在 Docker 容器中。

以下是我的安全配置。

@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    private UserDetailsService userDetailsService;

    @Autowired
    public SecurityConfig(UserDetailsServiceImpl service) {
        this.userDetailsService = service;
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        Map encoders = new HashMap<>();
        encoders.put(BCRYPT_ID, new BCryptPasswordEncoder(BCRYPT_ROUNDS));
        return new DelegatingPasswordEncoder(BCRYPT_ID,encoders);
    }


    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.cors()
            .and()
            .csrf().disable()
            .httpBasic();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {

        auth.userDetailsService(userDetailsService)
            .passwordEncoder(passwordEncoder()); …
Run Code Online (Sandbox Code Playgroud)

java spring-security bcrypt basic-authentication spring-boot

6
推荐指数
3
解决办法
1万
查看次数