小编use*_*358的帖子

找到以元素'global-method-security'开头的无效内容

在下面的代码我得到一个像这样的错误"cvc-complex-type.2.4.a:从元素'global-method-security'开始发现了无效的内容.其中一个'{" http://www.springframework. org/schema/beans ":import," http://www.springframework.org/schema/ beans":别名," http://www.springframework.org/schema/beans ":bean,WC [## other : "HTTP:// www.springframework.org/schema/beans"]," http://www.springframework.org/schema/beans ":豆}"预期".

怎么修好呢?

 <?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:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">



<context:component-scan base-package="client.security"/>

<global-method-security secured-annotations="enabled" />


</beans>
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

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

即使我重写equals(Object o),HashSet也不包含我的自定义对象

为什么这个程序的输出false?我期待truen对象初始化与我检查的相同的字符串.

public class Test {
    public static void main(String[] args) {
        Name n = new Name("jyoti", "meher");
        Set<Name> s = new HashSet();
        s.add(n);
        System.out.println(s.contains(new Name("jyoti", "meher")));
    }
}

class Name {
    String name, title;

    public Name(String name, String title) {
        this.name = name;
        this.title = title;
    }

    public boolean equals(Object o) {
        if (!(o instanceof Name)) {

            return false;
        }
        Name n = (Name) o;
        return n.name.equals(name) && n.title.equals(title);
    }
}
Run Code Online (Sandbox Code Playgroud)

java

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

标签 统计

java ×2

spring ×1

spring-security ×1