启动我的应用程序时,Spring Security 在我的 h2 数据库中创建两个表“用户”和“权限”。我的问题是,当我第二次启动应用程序时,数据库已经填充了这两个表,但是 Spring Security 直到想要创建它们。如果表不存在,我如何告诉 Spring Secutiry 仅创建表?或者我应该改变其他东西来解决这个问题?
Spring Secutiry 正在创建我从博客中获得的两个表,这些表描述了我查看过的一些代码。它说:“关于数据模型的一些说明。用户表中没有存储真实的用户名和密码。该表是由 Spring Security 定义的,用于通用用途,而不是特定于社交登录用例。”
我得到的错误消息,一些 java 堆栈跟踪,是:
Caused by: org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement at line 1 of resource class path resource [org/springframework/security/core/userdetails/jdbc/users.ddl]:
create table users(username varchar_ignorecase(50) not null primary key,password varchar_ignorecase(500) not null,enabled boolean not null); nested exception is org.h2.jdbc.JdbcSQLException: Table "USERS" already exists;
SQL statement: create table users(username varchar_ignorecase(50) not null primary key,password varchar_ignorecase(500) not null,enabled boolean not null) [42101-175]
Run Code Online (Sandbox Code Playgroud)
和
Caused …Run Code Online (Sandbox Code Playgroud) 我有这样的字符串
file-myfle_20130207_094852am.csv
Run Code Online (Sandbox Code Playgroud)
我如何编写正则表达式只提取数字
20130207094852
Run Code Online (Sandbox Code Playgroud) 我希望我的表单只在我的所有JavaScript函数都返回true时才提交.
这是我的Javascript代码:
function validateUserName(NewUser)
{
var u = document.forms["NewUser"]["user"].value
var uLength = u.length;
var illegalChars = /\W/; // allow letters, numbers, and underscores
if (u == null || u == "")
{
alert("You left Username field empty");
return false;
}
else if (uLength <4 || uLength > 11)
{
alert("The Username must be between 4 and 11 characters");
return false;
}
else if (illegalChars.test(u))
{
alert("The username contains illegal characters");
return false;
}
else
{
return true;
}
}
function …Run Code Online (Sandbox Code Playgroud) 我是新来的 Oauth 和 Spring-Security。我尝试使用客户端详细信息和数据库中的令牌详细信息将 oauth 与 Spring Security 集成。我正在使用最新的 depeneciesspring-security和spring-security-oauth。以下是我的依赖项:
<!-- Spring Security Dependencies -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<!-- END of Core Spring and Spring Web Dependencies -->
Run Code Online (Sandbox Code Playgroud)
版本如下。
<spring-security-oauth2>2.0.1.RELEASE</spring-security-oauth2>
<spring.security.version>3.2.4.RELEASE</spring.security.version>
Run Code Online (Sandbox Code Playgroud)
这是我的 maven 多模块项目。所以在父模块中管理所有依赖项。
以下是我spring-security-config.xml的 oauth2。
<?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:oauth="http://www.springframework.org/schema/security/oauth2"
xmlns:sec="http://www.springframework.org/schema/security" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
<!-- Create client details bean for …Run Code Online (Sandbox Code Playgroud) 在 spring文档中,我已经阅读了由执行器依赖项提供的名为“执行器”的端点,但我没有设法在我的本地测试应用程序上访问它。
问题:有人知道如何访问该端点吗?如果可能的话,粗略的:)
子问题 1:如果这个端点存在,那么为什么它是隐藏的?
子问题 2:如果此端点不存在,我们如何通知 spring.io 更正文档页面(打开某种票证)?
细节:
标签不起作用...... Jsp没有打印任何东西......我可以在Eclipse中调试jsp页面吗?视图
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<ul>
<c:forEach items="${listOfMyFriends}" var="friend">
<c:out value="${friend}"></c:out>
</c:forEach>
</ul>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
控制器在MyController.java中
@Controller
public class MyController {
@RequestMapping(value="/my")
public String getMyHomePage(Model model) {
LinkedList<String> listOfMyFriends = new LinkedList<String>();
listOfMyFriends.add("friend1");
listOfMyFriends.add("friend2");
listOfMyFriends.add("friend3");
listOfMyFriends.add("friend4");
model.addAllAttributes(listOfMyFriends);
return "my";
}
}
Run Code Online (Sandbox Code Playgroud) 我有以下字符串例如:' 24499 ? 00:02:05 sys-yg-ys'
如何验证字符串是否以函数结果中的字符串结尾(例如sys-yg-ys)?
我在上面的字符串上尝试了以下(仅检查简单的情况):result =''if(line.endswith('ys',len(line)-2,len(line)-1)):result ='true "
但是当我取得结果的价值时,我并没有成真.
java ×2
eclipse ×1
endpoint ×1
exception ×1
forms ×1
h2 ×1
html ×1
javascript ×1
jsp ×1
jstl ×1
oauth-2.0 ×1
python ×1
regex ×1
spring ×1
spring-boot ×1
spring-mvc ×1
string ×1
validation ×1