小编mCs*_*mCs的帖子

无法访问javax.servlet.Filter; 找不到javax.servlet.Filter的类文件

我正在尝试按照本文中的描述实施OAuth2 AuthorizationServer,但在下面仍然出现错误。对于spring安全配置:

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

@Configuration
@Order(1)
class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Value("${user.oauth.user.username}")
    private String username;
    @Value("${user.oauth.user.password}")
    private String password;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.requestMatchers()
                .antMatchers("/login", "/oauth/authorize")
                .and()
                .authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .formLogin().permitAll();
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication()
                .withUser(username)
                .password(passwordEncoder().encode(password))
                .roles("USER");
    }

    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}
Run Code Online (Sandbox Code Playgroud)

我不断收到此错误:

[ERROR] Failed to execute …
Run Code Online (Sandbox Code Playgroud)

java spring-security maven spring-security-oauth2

3
推荐指数
2
解决办法
4144
查看次数

UnstructedURLLoader 无法看到 libmagic

我尝试使用UnstructuredURLLoader如下

\n
from langchain.document_loaders import UnstructuredURLLoader\n\nloaders = UnstructuredURLLoader(urls=urls)\ndata = loaders.load()\n
Run Code Online (Sandbox Code Playgroud)\n

但有些页面报告说

\n
libmagic is unavailable but assists in filetype detection on file-like objects. Please consider installing libmagic for better results.\nError fetching or processing https://wellfound.com/company/chorus-one, exception: Invalid file. The FileType.UNK file type is not supported in partition.\n
Run Code Online (Sandbox Code Playgroud)\n

而在我的 conda 环境中我似乎拥有它

\n
%pip list | grep libmagic\nlibmagic                      1.0\n
Run Code Online (Sandbox Code Playgroud)\n

但我没有python-libmagic。当我尝试安装它时:

\n

pip install python-libmagic

\n

我不断收到错误:

\n
Collecting python-libmagic\n  Using cached python_libmagic-0.4.0-py3-none-any.whl\nCollecting cffi==1.7.0 (from python-libmagic)\n  Using …
Run Code Online (Sandbox Code Playgroud)

langchain py-langchain

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

sbt:添加多个解析器

我尝试添加两个解析器:

resolvers ++= Seq(
  Resolver.DefaultMavenRepositoryRoot,
  //Resolver.sonatypeRepo("releases"),
  Resolver.typesafeRepo("releases")
)
Run Code Online (Sandbox Code Playgroud)

但是我不断得到:

...build.sbt:9: 错误:没有隐含的 Append.Values[Seq[sbt.Resolver], Seq[java.io.Serializable]] 发现,
所以 Seq[java.io.Serializable] 不能附加到 Seq [sbt.Resolver] resolvers ++= Seq( ^ [error] Type error in expression Invalid response. Invalid response.

无效回复。

  1. 什么是默认解析器 resolvers什么?
  2. 怎么了?如何添加多个解析器?

scala sbt

2
推荐指数
1
解决办法
2226
查看次数

在SPRING-BOOT中使用较新的hibernate或JPA 2.2 for Java 8 Date/Time?

不支持使用s pring-boot 1.5.10(因此当前)使用Java8 Date/Time,因为默认情况下此版本的Spring Boot使用它.要在覆盖版本的部分中实现此目的(Spring Boot 1.5.10). Hibernate 5.0.12.Finalpom.xml properties

<hibernate.version>5.2.12.Final</hibernate.version>
Run Code Online (Sandbox Code Playgroud)

问题: 启用Java8日期/时间来覆盖hibernate版本或以某种方式(如果是这样,如何?)的最佳方法是什么?将JPA 2.2用于SPRING_BOOT?

编辑随着休眠,5.0.x我不断得到:

引起:org.springframework.jdbc.datasource.init.ScriptStatementFailedException:无法执行URL [file:./ src/main/resources/db/h2/data-h2.sql]的SQL脚本语句#1:INSERT INTO预留(ID,RESERVATION_NAME,DATE_FROM,DATE_TO)VALUES(1,'res1',ParseDateTime('01 01 2001','d M yyyy'),ParseDateTime('02 01 2001','d M yyyy')),(2 ,'res1',ParseDateTime('01 02 2001','d M yyyy'),ParseDateTime('02 02 2001','d M yyyy')),(3,'res3',ParseDateTime('01 03 2001' ,'d M yyyy'),ParseDateTime('02 03 2001','d M yyyy')),(4,'res4',ParseDateTime('01 04 2001','d M yyyy'),ParseDateTime('02 04 2001','d M yyyy')),(5,'res5',ParseDateTime('01 05 2001','d M yyyy'),ParseDateTime('02 05 2001','d M yyyy')); 嵌套异常是org.h2.jdbc.JdbcSQLException:Heksadecymalny string znieparzystąliczbąznaków:"2001-01-01 00:00:00.0"具有奇数个字符的十六进制字符串:"2001-01-01 00:00:00.0" ; SQL语句:INSERT INTO预留(ID,RESERVATION_NAME,DATE_FROM,DATE_TO)VALUES(1,'res1',ParseDateTime('01 01 2001','d M yyyy'),ParseDateTime('02 …

spring hibernate jpa spring-boot jpa-2.2

1
推荐指数
1
解决办法
2881
查看次数

诗无法安装九头蛇

Poetry 无法安装 Hydra,出现以下错误。如何用诗歌安装Hydra:

\n
$ poetry add hydra\n                                                                                                          \nUsing version ^2.5 for hydra\n\nUpdating dependencies\nResolving dependencies... (6.3s)\n\nWriting lock file\n\nPackage operations: 1 install, 0 updates, 0 removals\n\n  \xe2\x80\xa2 Installing hydra (2.5): Failed\n\n  CalledProcessError\n\n  Command '['/Users/mc/Library/Caches/pypoetry/virtualenvs/showcase-project-lis5iaDt-py3.9/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/Users/mc/Library/Caches/pypoetry/virtualenvs/showcase-project-lis5iaDt-py3.9', '--no-deps', '/Users/mc/Library/Caches/pypoetry/artifacts/d8/9a/72/7404c4669ad6d023f10626f1f4ad5a0f0bb0fe11b6e4ec7fe398dff895/Hydra-2.5.tar.gz']' returned non-zero exit status 1.\n\n  at /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py:528 in run\n       524\xe2\x94\x82             # We don't call process.wait() as .__exit__ does that for us.\n       525\xe2\x94\x82             raise\n       526\xe2\x94\x82         retcode = process.poll()\n       527\xe2\x94\x82         if check and retcode:\n    \xe2\x86\x92  528\xe2\x94\x82             raise CalledProcessError(retcode, …
Run Code Online (Sandbox Code Playgroud)

python hydra python-poetry

1
推荐指数
1
解决办法
1312
查看次数

对于给定的值范围,生成给定大小的所有可能的元组组合

假设我有3个参数:范围,n元素元组的大小(实际上也可能是列表)和可能的组合(无重复)。我想从范围中获取所有可能的数字组合。

因此,例如:

  • 范围a..b = 1..5
  • 元组的大小s = 2
  • 没有重复

    结果将是:

    (1,1)(1,2)(1,3)(1,4)(1,5)(2,1)(2,2)(2,3)(2,4)(2,5) (3,1)(3,2)(3,3)(3,4)(3,5)(4,1)(4,2)(4,3)(4,4)(4,5) (5,1)(5,2)(5,3)(5,4)(5,5)

有了重复,当然会有更多的元组。

显然,它可以迭代地完成,但是实现此任务的更加Python化和优雅的方式(也许是其他工具)将是什么?

python python-3.x

0
推荐指数
1
解决办法
41
查看次数