properties

SpringBoot——基础配置

空扰寡人 提交于 2020-02-22 00:21:44
目录 Tomcat配置 profile application-dev.properties apllication-test.properties application-pro.properties @ Tomcat配置 在Springboot项目中,可以内置tomcat、netty等容器。当添加了spring-boot-stater-web依赖之后,默认使用tomcat作为web容器。如果需要对tomcat进一步配置,可以在application.properties中进行配置。 server.port=8080 //web容器端口号 server.error.path=/error //当前项目出错的时候跳转页面 server.servlet.session.timeout=30m //配置了session的实效时间,m为分钟单位,默认单位为s server.servlet.context-path=/index //项目名称,默认为/ server.tomcat.uri-encoding=utf-8 // tomcat请求编码 server.tomcat.max-threads=500 // tomcat最大线程数 server.tomcat.basedir=/home/sang/tmp //tomcat运行日志和临时文件的存放目录 profile 在项目开发的时候

SpringBoot整合kaptcha验证码

泄露秘密 提交于 2020-02-21 17:41:42
说明 我用的是SpringBoot2 + thymeleaf。如果前后端分离的项目同理,无非是前端进行请求,后端配置验证码样式。 关于Kaptcha,是一款 可高度配置的实现验证码 的工具。可配置字体 样式、大小、颜色,验证码边框设置以及配置干扰线等等 。 配置 首先导入依赖 < ! -- 验证码 -- > < dependency > < groupId > com . github . penggle < / groupId > < artifactId > kaptcha < / artifactId > < version > 2.3 .2 < / version > < / dependency > 然后进行验证码Bean的配置 @Component public class KaptchaConfig { @Bean public DefaultKaptcha getDDefaultKaptcha ( ) { DefaultKaptcha dk = new DefaultKaptcha ( ) ; Properties properties = new Properties ( ) ; // 图片边框 properties . setProperty ( "kaptcha.border" , "yes" ) ; // 边框颜色 properties .

How to create dynamically named JavaScript object properties?

风流意气都作罢 提交于 2020-02-21 13:01:33
问题 Here is what I have <form> <input type="text" name="item1" class="grab" value="userInput" /> <input type="text" name="somethingelse1" class="grab" value="differentUserInput" /> ... (any number of inputs) </form> Using JQuery/Javascript I want to build an array of objects with name value pairs that looks like this: output = [ {item1: userInput}, {somethingelse1: differentUserInput} ... etc.]; I have tried this with no success: var output = new Array(); $('.grab').each( function(index) { output

How to create dynamically named JavaScript object properties?

我的未来我决定 提交于 2020-02-21 13:00:56
问题 Here is what I have <form> <input type="text" name="item1" class="grab" value="userInput" /> <input type="text" name="somethingelse1" class="grab" value="differentUserInput" /> ... (any number of inputs) </form> Using JQuery/Javascript I want to build an array of objects with name value pairs that looks like this: output = [ {item1: userInput}, {somethingelse1: differentUserInput} ... etc.]; I have tried this with no success: var output = new Array(); $('.grab').each( function(index) { output

How to create dynamically named JavaScript object properties?

我只是一个虾纸丫 提交于 2020-02-21 12:59:46
问题 Here is what I have <form> <input type="text" name="item1" class="grab" value="userInput" /> <input type="text" name="somethingelse1" class="grab" value="differentUserInput" /> ... (any number of inputs) </form> Using JQuery/Javascript I want to build an array of objects with name value pairs that looks like this: output = [ {item1: userInput}, {somethingelse1: differentUserInput} ... etc.]; I have tried this with no success: var output = new Array(); $('.grab').each( function(index) { output

How to create dynamically named JavaScript object properties?

守給你的承諾、 提交于 2020-02-21 12:58:34
问题 Here is what I have <form> <input type="text" name="item1" class="grab" value="userInput" /> <input type="text" name="somethingelse1" class="grab" value="differentUserInput" /> ... (any number of inputs) </form> Using JQuery/Javascript I want to build an array of objects with name value pairs that looks like this: output = [ {item1: userInput}, {somethingelse1: differentUserInput} ... etc.]; I have tried this with no success: var output = new Array(); $('.grab').each( function(index) { output

Java Spring用properties配置数据库连接池出现错误的处理方法[图]

孤街浪徒 提交于 2020-02-21 03:24:48
错误 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [db-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 78; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'contest:property-placeholder'. 保存数据库用户名等信息的properties文件 mysql-username=root mysql-password=abcd2020 mysql-jdbcUrl=jdbc:mysql://192.168.3.16/beers mysql-driverClass=com.mysql.jdbc.Driver Java的测试类 package com.mars.springtest; import org.junit.Test; import org

SpringBoot整合持久层技术--(一)JdbcTemplate

拜拜、爱过 提交于 2020-02-20 18:00:31
简介;   JdbcTemplate是Spring提供的一套JDBC模板框架,利用AOP技术解决直接使用JDBC带来的重复代码问题。它没有MyBatis使用那么灵活,但是却比直接使用JDBC方便得多。SpringBoot中对JdbcTemplate的使用提供了自动化配置类 JdbcTemplateAutoConfiguration 。   部分源码: @Configuration @ConditionalOnClass({DataSource.class, JdbcTemplate.class}) @ConditionalOnSingleCandidate(DataSource.class) @AutoConfigureAfter({DataSourceAutoConfiguration.class}) @EnableConfigurationProperties({JdbcProperties.class}) public class JdbcTemplateAutoConfiguration { public JdbcTemplateAutoConfiguration() { } @Configuration static class JdbcTemplateConfiguration { private final DataSource dataSource; private

JDBC学习笔记之JDBC工具类(九)

▼魔方 西西 提交于 2020-02-20 07:05:08
我们可以看到前面的Demo中都有非常多的 重复的代码 ,我们可以写一个 JDBC工具类 去封装这些 重复的代码 抽取JDBC工具类:JDBCUtils 目的:简化书写 分析: 1. 抽取注册驱动 跟连接对象用同样的方法解决,用 配置文件 2. 抽取一个方法获取连接对象 需求 :不想传递参数(麻烦),还得保证工具类的通用性 解决 :配置文件 jdbc.properties jdbc . properties url = user = password = 3. 抽取一个方法释放资源 由于释放的资源数量不定,所以使用 重载 Coding 我们写JDBC工具类定义的方法都是 静态方法 ,以便于调用 因为 动态方法 属于 示例对象 ,必须创建出对象才能调用 而 静态方法 属于 类 ,无需创建对象也能调用 连接对象 我们先来写 连接对象 : public static Connection getConnection ( ) throws SQLException { return DriverManager . getConnection ( url , user , password ) ; } url、user、password 我们用静态代码块( static )去加载,因为这些信息我们不希望每次调用JDBC工具类都获取一次,没有必要;而使用静态代码块就能恰到好处地只获取一次 url

Specify pom properties via a properties file?

故事扮演 提交于 2020-02-20 05:39:11
问题 Due to the way my build system is designed (RTC Build Engine), I would like to provide maven with property values via a properties file, instead of specifying -Dkey=value for every property. I found a couple of questions on S.O. (How to set build properties from a file in Maven POM? and How to read an external properties file in Maven) that relate precisely to this question, but they are relatively old, and both require custom plugins to work (in alpha state). I realize that passing