启动一个新应用程序,我安装了 eslint 并使用以下配置对其进行了配置,但是每次我创建enum它时它都说它已经被定义了。甚至是无意义的字符串。其他变量类型(const、var、let)没有这个问题。我可以禁用该规则,但我希望它适用于实际情况。
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"project": ["./tsconfig.json"],
"ecmaFeatures": {
"ecmaVersion": 6,
"jsx": true
}
},
"overrides": [],
"extends": [
"airbnb-typescript",
"prettier",
"prettier/@typescript-eslint",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"spaced-comment": 0,
"import/prefer-default-export": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/restrict-template-expressions": [
1,
{ "allowBoolean": true }
],
"react/jsx-props-no-spreading": "off",
"react/state-in-constructor": 0,
"react/require-default-props": 0,
"react/destructuring-assignment": [
1,
"always",
{
"ignoreClassFields": true
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
我试图找出通过其类选择元素的第n个子元素的语法,但是我不知道该元素的确切路径.我做不到$('parent > child > grandchild > hereIam');
所以基本上我需要能够说出来
$('#thisElement').AllRelativesWithClass('.classToSelect')
Run Code Online (Sandbox Code Playgroud)
我到底该怎么做?
我试图通过WebMvcConfigurerAdapter如下所示全局配置CORS .测试我通过我创建的小节点应用程序来模拟外部服务.当我尝试这种方法时,响应不包含正确的标题,并失败
XMLHttpRequest cannot load http://localhost:8080/api/query/1121. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:333' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
全球配置
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@EnableWebMvc
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/query/**")
.allowedOrigins("*")
.allowedHeaders("*")
.allowCredentials(true);
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我使用这样的@CrossOrigin注释时,它可以很好地响应正确的标题.
@CrossOrigin(origins = "*", allowCredentials = "true", allowedHeaders = "*")
@RestController
@RequestMapping(value = "/api/query", produces = MediaType.APPLICATION_JSON_VALUE)
public class QueryController {
......
}
Run Code Online (Sandbox Code Playgroud)
产生
Access-Control-Allow-Credentials:true …Run Code Online (Sandbox Code Playgroud) 我最近在DAO类中删除了一个未使用的Injected bean,虽然应用程序按预期运行,但它在启动时在Tomcat中导致了以下堆栈跟踪错误.当我替换这个未使用的自动连线bean定义时,它似乎消失了,这让我觉得它在某个方面需要在destroy函数中,但是destroy这个类没有指定的函数.所以我知道它在某种程度上被引用,但我不知道如何,并且启用DEBUGspring级别登录并没有提供更多信息.
现在删除的Service类确实引用了这个DAO类,但是DAO类(现在)并没有在任何地方引用Service类.我不确定我错过了什么Spring魔法来解决这个问题.
编辑:使用弹簧4.2.3.RELEASE
EIDT 2:CustomFormService使用注释(@Service)创建类,而使用XML配置创建DAO类.当我切换到使用@Component注释和包扫描CustomDataFormDAO类时,堆栈跟踪消失了,但我不知道为什么.
<dependency org="org.springframework" name="spring-core" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-jdbc" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-jms" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-orm" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-oxm" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-struts" rev="3.2.14.RELEASE"/>
<dependency org="org.springframework" name="spring-test" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-tx" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-web" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-webmvc" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework" name="spring-context-support" rev="4.2.3.RELEASE"/>
<dependency org="org.springframework.ldap" name="spring-ldap" rev="1.3.1.RELEASE"/>
<dependency org="org.springframework.security" name="spring-security-core" rev="4.0.3.RELEASE"/>
<dependency org="org.springframework.security" name="spring-security-ldap" rev="4.0.3.RELEASE"/>
<dependency org="org.springframework.ws" name="spring-ws-core" rev="2.2.2.RELEASE"/> …Run Code Online (Sandbox Code Playgroud) 我有以下带注释的类,我试图从lucene/hibernate搜索查询中对结果进行排序.我终于让查询正常工作但似乎当我实现必要的注释(在jobStatus上看到)对该列进行排序时,它使得无法再搜索该列.我基于谷歌在这里找到的说明.我一直在解决整个hibernate搜索和排序问题,现在我终于想出如何排序和搜索我需要的是能够一起完成它们.
@Entity
@Table(name="jobReq")
@Indexed
public class JobReq {
@Id
@DocumentId
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
@Field(index = Index.YES)
@Column(name="jobId", nullable=false, unique=true)
private String jobId;
@Field(index = Index.YES)
@Column(name="jobTitle", nullable=false)
private String jobTitle;
@Field(index = Index.YES)
@Column(name="jobContract", nullable=false)
private String contract;
@Field(index = Index.YES)
@Column(name="jobProject", nullable=true)
private String project;
@Field(index = Index.YES)
@Column(name="jobLaborCategory", nullable=false)
private String laborCategory;
@Field(index = Index.YES)
@Column(name="jobSummary", nullable=false)
private String summary;
@Field(index = Index.YES)
@Column(name="jobDescription", nullable=false)
private String jobDescription;
@Fields({@Field, @Field(analyze = Analyze.NO, name …Run Code Online (Sandbox Code Playgroud) 我总是做这样的内连接
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID;
Run Code Online (Sandbox Code Playgroud)
在哪里指定所需的每一行.我目前正在使用一个有50行的表,但我不想用所有行键入所有这些SQL连接,有没有办法说"从订单中选择*,然后给我Customers.CustomerName加入. ..."而不是指定第一个表中的每一行?
我试图用一个并不总是存在的分隔符选择字符串的第一部分.我有以下SUBSTRING功能,当分隔符存在时效果很好,但是当它不是,即下面的查询时不返回任何内容
SELECT SUBSTRING(sc.location +'/',0, CHARINDEX('/', sc.location)) FROM sc
Run Code Online (Sandbox Code Playgroud)
Tower #1该值的收益率Tower #1/Room #3,但NULL如果输入是正确的Tower #5
如果分隔符不存在,有没有办法返回完整的字符串?
这是我第一次尝试自己设置一个Web应用程序项目,由于某种原因,我甚至无法使用hello world设置.我将所有内容设置为默认值,选择用于编译的JDK1.8和带有仅包含文本的index.html页面的Tomcat7服务器.在将项目添加到服务器之后,我应该可以右键单击项目并在服务器上运行,但即使使用这个简单的设置,我仍然可以获得404.我错过了什么?

Web.xml欢迎列表:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
Run Code Online (Sandbox Code Playgroud)
java ×4
class ×1
cors ×1
cross-domain ×1
delimiter ×1
destroy ×1
eclipse ×1
eslint ×1
foreign-keys ×1
hibernate ×1
html ×1
http-headers ×1
inner-join ×1
join ×1
jquery ×1
lucene ×1
mysql ×1
node.js ×1
regex ×1
selector ×1
sorting ×1
spring ×1
spring-bean ×1
spring-mvc ×1
sql ×1
string ×1
substring ×1
tomcat ×1
tomcat7 ×1
typescript ×1
wildcard ×1