我正在构建一个 Spring Restful 项目,其中我应用了摘要身份验证的 Spring Security,我已将 Spring 依赖项的版本从 3.0.4 升级到 3.1,因此我遇到以下错误: java.lang.NoSuchMethodError:org.springframework.web .method.support.HandlerMethodArgumentResolverComposite.addResolvers(Ljava/util/List;)Lorg/springframework/web/method/supportHandlerMethodArgumentResolverComposite;
我必须将 spring 的新版本升级到 3.1 才能使用其安全前景。请帮我解决这个问题。
下面是我的 spring 框架的 pom.xml 中的依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId> …Run Code Online (Sandbox Code Playgroud) 我的java类中有以下字符串
String str="0000000000008";
Run Code Online (Sandbox Code Playgroud)
现在我想增加它,以便下一个值应该是0000000000009
为此,我尝试将此String str转换为Integer
Integer i=Integer.parseFloat(str)+1;
Run Code Online (Sandbox Code Playgroud)
当我打印i它的值时,它只打印17(因为它在转换时从字符串中删除了前导0).
如何增加String值,以便保留前导0,系列将继续?
我有
String newStr = "previous"
Run Code Online (Sandbox Code Playgroud)
过了一段时间我想把我的字符串改成next.我现在能做到
newStr=getNewString(); // Say getNewString return `next`
Run Code Online (Sandbox Code Playgroud)
Arent字符串应该是不可变的.
我能用其他任何方式实现这个目标吗 谢谢.
编辑:neww代替new
我想让PyGTK Tree-view(耦合到List Store)的选择行不可选,如果可能的话,显示为灰色.
有没有办法做到这一点?
我想在Motor类中创建一个构造函数(Motor),我想在Contructor1类中调用它,但是当我这样做时我有一个错误.....我不知道为什么.我刚刚从本周开始学习java.
这是代码:
class Motor{
Motor(int type[]){
int input;
input=0;
type = new int[4];
for(int contor=0; contor<4; contor++){
System.out.println("Ininsert the number of cylinders:");
Scanner stdin = new Scanner(System.in);
input = stdin.nextInt();
type[contor] = input;
System.out.println("Motor with "+type[contor]+" cylinders.");
}
}
}
public class Contructor1 {
public static void main(String[] args){
Motor motor_type;
for(int con=0; con<4; con++){
motor_type = new Motor();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有以下 GeoJSON 数据文件,其中包含一个带坐标的多边形。
[
{
"geometry": {
"type": "Polygon",
"coordinates":
[
[
[
9.137248,
48.790411
],
[
9.137248,
48.790263
],
[
9.13695,
48.790263
],
[
9.137248,
48.790411
]
]
]
}
}
]
Run Code Online (Sandbox Code Playgroud)
在 的帮助下org.geotools.geojson.geom.GeometryJSON,我正在解析com.vividsolutions.jts.geom.Polygon类中的 JSON 坐标,如下所示。并检查是否Coordinate(9.13710, 48.790360)在这个多边形内。
GeometryJSON g = new GeometryJSON();
com.vividsolutions.jts.geom.Polygon polygon = g.readPolygon(new File(fileLocation));
System.out.println("Type="+polygon.getGeometryType());
GeometryFactory gf = new GeometryFactory();
boolean pointIsInPolygon = polygon.contains(gf.createPoint(new Coordinate(9.13710, 48.790360)));
System.out.println("Point is in polygon="+pointIsInPolygon);
Run Code Online (Sandbox Code Playgroud)
但是我的程序总是给我下面的结果,即给定的坐标不在多边形中。
类型=多边形
a) 你能看出为什么pointIsInPolygon是假的。我错过了什么吗?
b) 我应该在这里给出什么坐标,所以 …