小编sun*_*leo的帖子

如何使用java检查字符串中的所有字符是小写的

我试过这样但输出错误,请帮帮我

String inputString1 = "dfgh";// but not dFgH
String regex = "[a-z]";
boolean result;

Pattern pattern1 = Pattern.compile(regex);
Matcher matcher1 = pattern1.matcher(inputString1);
result = matcher1.matches();
System.out.println(result);
Run Code Online (Sandbox Code Playgroud)

java regex

7
推荐指数
2
解决办法
2万
查看次数

SpringBoot 401 UnAuthorized即使没有安全性

我没有使用Spring Security,但它要求我进行身份验证.

在此输入图像描述

URL的异常(http:// localhost:8080/SpringJob/ExecuteJob):

{
    "timestamp": 1500622875056,
    "status": 401,
    "error": "Unauthorized",
    "message": "Bad credentials",
    "path": "/SPPA/ExecuteSPPAJob"
}
----below log details
2017-07-21 13:15:35.210  INFO 19828 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/SpringJob]   : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-07-21 13:15:35.210 [http-nio-8080-exec-1] INFO 
                    o.a.c.c.C.[.[localhost].[/SpringJob]-Initializing Spring FrameworkServlet 'dispatcherServlet' 
2017-07-21 13:15:35.211  INFO 19828 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2017-07-21 13:15:35.211 [http-nio-8080-exec-1] INFO 
                    o.s.web.servlet.DispatcherServlet-FrameworkServlet 'dispatcherServlet': initialization started 
2017-07-21 13:15:35.494  INFO 19828 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 282 ms
2017-07-21 13:15:35.494 [http-nio-8080-exec-1] …
Run Code Online (Sandbox Code Playgroud)

java spring controller spring-security spring-boot

7
推荐指数
6
解决办法
3万
查看次数

ReferenceError:指定了未知插件"react-html-attrs"

我已经尝试过一路运行基于YouTube的示例模块 - 加载程序,但即使在跟随stackoverflow中关于此的所有链接之后,我也无法解决问题.请在下面找到我的项目的详细信息,

我的项目结构: 在此输入图像描述

**package.json**
{
  "name": "react-tutorials",
  "version": "0.0.0",
  "description": "",
  "main": "webpack.config.js",
  "dependencies": {
    "babel-core": "^6.17.0",
    "babel-loader": "^6.2.5",
    "babel-plugin-add-module-exports": "^0.1.2",
    "babel-plugin-react-html-attrs": "^2.0.0",
    "babel-plugin-transform-class-properties": "^6.3.13",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-stage-0": "^6.16.0",
    "react": "^0.14.6",
    "react-dom": "^0.14.6",
    "webpack": "^1.12.9",
    "webpack-dev-middleware": "^1.8.4",
    "webpack-dev-server": "^1.14.1",
    "webpack-hot-middleware": "^2.12.2"
  },
  "devDependencies": {
    "babel-core": "^6.17.0",
    "babel-loader": "^6.2.5",
    "babel-plugin-add-module-exports": "^0.1.2",
    "babel-plugin-react-html-attrs": "^2.0.0",
    "babel-plugin-transform-class-properties": "^6.3.13",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-stage-0": "^6.16.0",
    "react": "^0.14.6",
    "react-dom": "^0.14.6",
    "webpack": "^1.12.9",
    "webpack-dev-middleware": "^1.8.4",
    "webpack-dev-server": "^1.14.1",
    "webpack-hot-middleware": …
Run Code Online (Sandbox Code Playgroud)

javascript npm webpack es6-module-loader

6
推荐指数
1
解决办法
3732
查看次数

Spring Boot JDBC模板SQL日志

我正在尝试使用params for Spring Boot JDBC进行日志SQL查询,但它没有在日志中打印详细信息.我正在使用Spring Boot 1.5.8版本.请帮我解决这个问题.

application.properties:

spring.datasource.url=url
spring.datasource.username=user
spring.datasource.password=password
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver

logging.level.org.springframework.jdbc.core.JdbcTemplate=debug

spring.datasource.type = com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.connection-timeout=60000
spring.datasource.hikari.maximum-pool-size=2
Run Code Online (Sandbox Code Playgroud)

库:

@Repository
public class DataRepository {
    private static Logger log = LoggerFactory.getLogger(DataRepository.class);

    @Autowired
    private NamedParameterJdbcTemplate jdbcTemplate;

    public Data findDataObjet() throws Exception {

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("id1", "mike");
        parameters.put("id2", new Long(1));

        String sqlString = "select * from table1 where id1 = ":id" and id2 = :id2";
        log.info("Query:" + sqlString);//this log is printing

        Data extObj = jdbcTemplate.query(sqlString, parameters, (rs) -> { …
Run Code Online (Sandbox Code Playgroud)

java log4j spring-jdbc spring-boot

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

Spring引导JDBCTemplate与c3p0 DataBase池和故障转移

我需要在SpringBoot应用程序(嵌入式tomcat)中使用jdbctemplate建立数据库连接失败,使用c3p0连接池.这是我的应用程序的应用程序.我有主数据库和辅助数据库.如果主要失败则应使用辅助数据库运行时的数据库连接故障转移.请帮助我实现这一点.我试图包含多个数据库URL作为配置的一部分,但是无法正常工作.

c3p0 Java数据库池,故障转移配置 https://docs.genesys.com/Documentation/Composer/8.1.4/Help/ConnectionPooling

application.properties :(错误即将到来)

#      connection properties for data source
##########################################################################################################
spring.datasource.c3p0.driverClass=oracle.jdbc.driver.OracleDriver
spring.datasource.c3p0.maxConnectionAge=3600
spring.datasource.c3p0.maxIdleTime=600
spring.datasource.c3p0.initialPoolSize=5
spring.datasource.c3p0.maxPoolSize=10
spring.datasource.c3p0.minPoolSize=5
spring.datasource.c3p0.acquireIncrement=1

##########################################################################################################


spring.datasource.url=jdbc:oracle:thin:@primary.com:1521:db1,jdbc:oracle:thin:@secondary.com:1521:db2
spring.datasource.username=user
spring.datasource.password=password
Run Code Online (Sandbox Code Playgroud)

java jdbc spring-jdbc c3p0 spring-boot

6
推荐指数
1
解决办法
1613
查看次数

分配并创建新的字符串差异

        String s1 = new String("string");
        String s2 = new String("string");

        String s3 = "string";
        String s4 = "string";

        System.out.println(s1 == s2);      //FALSE
        System.out.println(s2.equals(s1)); //TRUE

        System.out.println(s3 == s4);      //TRUE
        System.out.println(s3.equals(s4)); //TRUE
Run Code Online (Sandbox Code Playgroud)

创造s1和有s3什么区别?请告诉我

在String中我们只有String对象,那么为什么它以不同的方式处理这两个.s1和s2具有不同的存储器地址,而s3和s4具有相同的存储器地址.为什么它基于new运营商.

java string

5
推荐指数
1
解决办法
1001
查看次数

Internet Explorer 11缺少兼容模式

在Internet Explorer 11中如何检查IE9和IE10的兼容性视图,默认情况下找不到东西,我无法将自己从ie11更改为ie9或ie10.

我用谷歌搜索,没有找到任何有用的东西.下面是其中之一,但使用ie10我可以得到所有较低版本的兼容视图,但这是不可能使用ie11.

To change your Compatibility View settings
Open Internet Explorer for the desktop, click Tools, and then click Compatibility View settings.
In the Compatibility View Settings box, add the problematic website URL, and then click Add.
Compatibility View is turned on for this single website, for this specific computer.
Decide if you want your intranet sites displayed using Compatibility View, decide whether to use Microsoft compatibility lists, and then click Close.
Run Code Online (Sandbox Code Playgroud)

browser internet-explorer

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

prolog中不允许引用

请帮我找到这个例外的原因,使用下面的罐子,

core-renderer.jar
itext-paulo-155.jar
Run Code Online (Sandbox Code Playgroud)

firstdoc.xhtml

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
        &lt;title&gt;My First Document&lt;/title&gt;
        &lt;style type="text/css"&gt; b { color: green; } &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;p&gt;
            &lt;b&gt;Greetings Earthlings!&lt;/b&gt;
            We've come for your Java.
        &lt;/p&gt;
    &lt;/body&gt;
&lt;/html&gt;
Run Code Online (Sandbox Code Playgroud)

JAVA:

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.xhtmlrenderer.pdf.ITextRenderer;

import com.lowagie.text.DocumentException;

public class Sample1 {
    public static void main(String[] args)  throws IOException, DocumentException {
                String inputFile = "C:/Users/Joseph.M/WorkPlace_Struts2/Fly-Sauccer/src/test/pdf/firstdoc.xhtml";
                String url = new File(inputFile).toURI().toURL().toString();
                String outputFile = …
Run Code Online (Sandbox Code Playgroud)

java xml flying-saucer

5
推荐指数
1
解决办法
1万
查看次数

飞碟中的外部CSS

我想知道如何在包括飞Saucer.Before外部CSS是THB我在所有的可用链接检查StackOverflow,但他们不是helpful.That就是为什么使这个一个我自己的原因.

TestCSS.xhtml重命名的版本TestCSS.html.它们的内容相同.下面(图1)是Eclipse IDE中我的项目的结构.如果我运行TestCSS.html,它将在浏览器中将页面结果作为图像2给出.

以下是不作为外部CSS工作的代码:

This one Working :
<style>
.redFontClass
{
  color : red;
}
.blueFontClass
{
  color : blue;
}
</style>

This one NOT Working :
<link href="RedCSS.css" rel="stylesheet" type="text/css" />

This one NOT Working :
<link rel="stylesheet" 
href="http://localhost:8888/Fly-Sauccer-Web/css/RedCSS.css" type="text/css" />

This one NOT Working :
<link href="file:///C:/Users/Joseph.M/WorkPlace_Struts2/Fly-Sauccer-Web/WebContent/css/RedCSS.css"  rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)

我尝试了所有方法,包括xhtml内部的css的绝对路径.但css没有得到应用.请帮我解决问题.

图片1

在此输入图像描述

图2

在此输入图像描述

RedCSS.css

.fontClass
{
  color : red;
}
Run Code Online (Sandbox Code Playgroud)

TestCSS.html

<html>
<head>
<link href="file:///C:/Users/Joseph.M/WorkPlace_Struts2/Fly-Sauccer-Web/WebContent/css/RedCSS.css"  rel="stylesheet" type="text/css" />
</head>
<body>
<b>This …
Run Code Online (Sandbox Code Playgroud)

css java flying-saucer

5
推荐指数
1
解决办法
5330
查看次数

Hawt.io 的 Spring Security

我想配置Spring Security for Hawt.io嵌入式tomcat。使用(用户和密码)自定义登录后,Hawt.io 登录要求进行身份验证。但是 Hawt.io 身份验证在代码和配置中被禁用。如果我删除然后MvcConfig没有任何有效的身份验证。但是WebSecurityConfigsecurity.basic.enable= false

我想使用自定义用户名和密码进行身份验证,该用户名和密码在 Hawt.io 也询问凭据后起作用,尽管该部分已禁用。

请帮我解决这个问题。

应用程序属性

hawtio.authenticationEnabled = false
management.security.enabled=false
security.basic.enable= true
security.ignored= /**
Run Code Online (Sandbox Code Playgroud)

登录.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
    <head>
        <title>Spring Security Example </title>
    </head>
    <body>
        <div th:if="${param.error}">
            Invalid username and password.
        </div>
        <div th:if="${param.logout}">
            You have been logged out.
        </div>
        <form th:action="@{/login}" method="post">
            <div><label> User Name : <input type="text" name="username"/> </label></div>
            <div><label> Password: <input type="password" name="password"/> </label></div>
            <div><input type="submit" value="Sign In"/></div>
        </form>
    </body>
</html> …
Run Code Online (Sandbox Code Playgroud)

java spring-security hawtio

5
推荐指数
1
解决办法
3773
查看次数