我试图通过设置最基本的工作程序来弄清楚Spring LDAP(不是 Spring安全事件)是如何工作的,但似乎实际的身份验证中断了.
这是我得到的错误:
Exception in thread "main" java.lang.NullPointerException
at org.springframework.ldap.core.support.AbstractContextSource.getReadOnlyContext(AbstractContextSource.java:125)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:287)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:237)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:588)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:546)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:401)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:421)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:441)
在抛出异常的方法中执行的代码是:
return getContext(authenticationSource.getPrincipal(),
authenticationSource.getCredentials());
Run Code Online (Sandbox Code Playgroud)
所以我似乎需要在应用程序上下文中设置身份验证源?我真的迷路了.
这是我的代码:
package se.test.connector.ldap;
import java.util.List;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ldap.core.AttributesMapper;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.core.support.LdapContextSource;
import org.springframework.ldap.filter.EqualsFilter;
public class LdapTest {
public static void main(String[] args) {
LdapContextSource ctxSrc = new LdapContextSource();
ctxSrc.setUrl("ldap://<ldapUrl>:389");
ctxSrc.setBase("DC=bar,DC=test,DC=foo");
ctxSrc.setUserDn("<username>@bar.test.foo");
ctxSrc.setPassword("<password>");
LdapTemplate tmpl = …Run Code Online (Sandbox Code Playgroud) Redux 减速器应该没有副作用。但是,如果一个动作应该触发在浏览器中下载一个文件,其中内容是基于商店的状态呢?这当然应该算作副作用吗?像下面这样的东西会很好还是我应该寻找替代方法?
case 'SAVE_GRID': {
const { json } = state
fileDownload(json, 'data.json', 'application/json')
return state
}
Run Code Online (Sandbox Code Playgroud) 我正在用Python写一个Uno游戏,我正在设置一个Uno套牌.
_VALID_FACES = ['skip', 'draw2', 'reverse', 'wild', 'wild4'] + range(10)
Run Code Online (Sandbox Code Playgroud)
我认为这应该是好的和花花公子,没问题.但是,PyCharm坚持这个错误:
Expected type list[str] (matched generic type 'list[T]'), got 'list[int]' instead
Run Code Online (Sandbox Code Playgroud)
现在我不完全确定这意味着什么.有任何想法吗?代码运行,但警告仍在PyCharm中.
我跑步时遇到这个错误flow check,但我不确定这意味着什么.
不能将导出用作类型,因为exports是一个值.要获取值的类型,请使用typeof.
错误位置为0:1(在@flow注释中).这是代码:
/* @flow */
import Chunk from '../models/Chunk'
export interface IChunkSorter {
sort(chunks: Chunk[]): Chunk[];
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?我用谷歌搜索了错误信息,但实际上没有结果.
我使用 Webpack 使用 Flow 类型构建我的 React 项目。我已经将 Webpack 配置为使用svg-sprite-loader导入 SVG 文件,如下所示:
{
test: /\.svg$/,
loader: ['svg-sprite-loader']
}
Run Code Online (Sandbox Code Playgroud)
这使我可以“导入”SVG 文件,如下所示:
import letterCellSymbol from '../styles/icons/tool-letter.svg'
Run Code Online (Sandbox Code Playgroud)
然后我可以像这样使用我的 React 组件中的文件:
<svg className="icon">
<use xlinkHref={`#${letterCellSymbol.id}`} />
</svg>
Run Code Online (Sandbox Code Playgroud)
这当然会导致 Flow 类型检查出现问题:
Error: src/components/Toolbox.jsx:70
70: <use xlinkHref={`#${letterCellSymbol.id}`} />
^^ property `id`. Property not found in
70: <use xlinkHref={`#${letterCellSymbol.id}`} />
^^^^^^^^^^^^^^^^ String
Run Code Online (Sandbox Code Playgroud)
告诉 Flow 这些 SVG 文件使用类型导出对象{id: string}或完全忽略这些错误的正确方法是什么?
假设我有一个带有文档字符串的函数,其中我将返回类型声明为带有两个字符串的元组:
def foo():
"""
Returns:
Tuple[str, str]: Tuple of first name and last name
"""
Run Code Online (Sandbox Code Playgroud)
如果我不在文档字符串之外的任何地方使用它,Tuple我是否应该导入它?typing
我最近建立了一个基于https://electron-react-boilerplate.js.org的新项目。这有点奏效,然后我决定重新开始并将电子反应样板 Git 存储库重新克隆到新目录并删除旧目录。
现在,当我yarn run dev在新项目目录中运行时,出现一个奇怪的错误:
Reading /Users/myuser/Code/OLD_PROJECT_NAME/node_modules/devtron/manifest.json failed.
Error: ENOENT: no such file or directory, open '/Users/myuser/Code/OLD_PROJECT_NAME/node_modules/devtron/manifest.json'
at Object.fs.openSync (fs.js:577:3)
at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:166:20)
at Object.fs.readFileSync (fs.js:483:33)
at Object.fs.readFileSync (ELECTRON_ASAR.js:563:29)
at getManifestFromPath (/Users/myuser/Code/NEW_PROJECT_NAME/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/chrome-extension.js:30:26)
at Function.BrowserWindow.addExtension (/Users/myuser/Code/NEW_PROJECT_NAME/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/chrome-extension.js:362:22)
at Function.BrowserWindow.addDevToolsExtension (/Users/myuser/Code/NEW_PROJECT_NAME/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/chrome-extension.js:394:40)
at App.<anonymous> (/Users/myuser/Code/NEW_PROJECT_NAME/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/chrome-extension.js:423:23)
at Object.onceWrapper (events.js:273:13)
at App.emit (events.js:187:15)
请注意,出于某种原因,它尝试从旧项目目录中读取 manifest.json 文件,该目录甚至不再存在。我已经搜索了整个新目录以查找旧项目名称的出现,以寻找可能出错的地方,但没有任何结果。
我试过删除node_modules,没有帮助。
我也试过跑步,yarn cache clean但这也无济于事。
它可能从哪里获取旧项目目录?
我在使用 Node 11.4.0 的 macOS Mojave。
我试图控制Spring的自动装配,但似乎无法正确地实例化bean(a DocumentBuilder)。我已经这样创建了一个自定义JSP标记:
public class MyTag extends SimpleTagSupport {
@Autowired
private DocumentBuilder documentBuilder;
public void setBuilder(DocumentBuilder builder) {
this.documentBuilder = builder;
}
@Override
public void doTag() throws IOException {
// documentBuilder is null in here!
}
}
Run Code Online (Sandbox Code Playgroud)
这是servlet配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Scan for HTTP/REST controllers -->
<context:component-scan base-package="the.right.package" />
<context:annotation-config/>
<bean id="documentBuilderFactory"
class="javax.xml.parsers.DocumentBuilderFactory"
factory-method="newInstance">
<property name="validating" value="false" />
<property name="ignoringElementContentWhitespace" value="true" />
</bean>
<bean id="documentBuilder" class="javax.xml.parsers.DocumentBuilder"
factory-bean="documentBuilderFactory" …Run Code Online (Sandbox Code Playgroud)