我想根据我的application.properties从log4j2.xml文件中更改一些属性,因此例如定义一些属性,然后在log4j2中替换那些作为参数的属性.
我跑了不同的方法,但我仍然没有做对的事情.我想根据环境(DEV,QA或PROD)有不同的配置.有人可以指导我如何实现这一目标吗?
所以,我想在我的房产里有这个
#Place holders for log4j2.xml file
log.file.path=/opt/tomcat/logs
log.file.name=dummydummy
log.file.size=100 MB
log.level=DEBUG
Run Code Online (Sandbox Code Playgroud)
请在下面找到我的log4j2示例...
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">
<Properties>
<Property name="PID">????</Property>
<property name="name">my-log</property>
</Properties>
<Appenders>
<RollingFile name="file" fileName="${log.file.path}${log.file}.log"
filePattern="${log.file.path}${log.file}-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout
pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${sys:PID} --- [%t] %c{1}(%M:%L) : %m%n%wEx" />
<Policies>
<TimeBasedTriggeringPolicy /><!-- Rotated everyday -->
<SizeBasedTriggeringPolicy size="${log.file.size}" /> <!-- Or every 100 MB -->
</Policies>
</RollingFile>
<Console name="Console" target="SYSTEM_OUT" follow="true">
<PatternLayout
pattern="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%t]}{faint} %clr{%c{1}(%M:%L)}{cyan} %clr{:}{faint} %m%n%wEx" />
</Console>
</Appenders>
<Loggers>
<Logger name="org.hibernate.validator.internal.util.Version"
level="warn" …Run Code Online (Sandbox Code Playgroud) 我想知道哪种是使用GitHub API(Rest API v3)从git存储库获取最新提交信息的最佳方法.
选项1:GET /repos/:owner/:repo/commits/master
我可以假设响应的对象'commit'是分支主控的最新提交吗?
选项2:GET /repos/:owner/:repo/git/commits/5a2ff
或者调用,一个通过从master获取HEAD ref来获取sha,然后使用返回的sha获取提交信息.
谢谢您的帮助
我正在尝试使用spring-boot和spring security做一个例子.我的想法是创建一个Web应用程序并提供API,我希望两者都有安全性; 所以我需要创建一个多http网络安全配置,但它不起作用.
我按照这个链接http://docs.spring.io/spring-security/site/docs/3.2.x/reference/htmlsingle/#multiple-httpsecurity但没有成功.而且,我收到了这个错误
创建名为"webSecurityConfiguration"的bean时出错:注入自动连接的依赖项失败; 嵌套异常是java.lang.IllegalStateException:无法将org.springframework.security.config.annotation.authentication.configurers.provisioning.InMemoryUserDetailsManagerConfigurer应用于已构建的对象
我正在使用的配置如下:
@Configuration
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
@EnableGlobalAuthentication
@EnableGlobalMethodSecurity(securedEnabled = true)
public class WebSecurityConfiguration {
@Autowired
protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("12345").roles("USER").and()
.withUser("admin").password("12345").roles("USER", "ADMIN");
}
@Configuration
@Order(1)
public static class ApiConfigurationAdapter extends
WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.antMatcher("/api/**")
.authorizeRequests()
.anyRequest().hasRole("ADMIN")
.and()
.httpBasic();
}
}
@Configuration
@Order(2)
public static class WebConfigurationAdapter extends
WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/resources/**");
}
@Override …Run Code Online (Sandbox Code Playgroud) 我使用spring-boot 1.2.5 + thymeleaf + spring security来应用我的应用程序.
我需要在我的网站上显示用户名,经过一些研究似乎我应该使用类似的代码:
<div sec:authentication="name">The value of the "name" property of
the authentication object should appear here.</div>
Run Code Online (Sandbox Code Playgroud)
但是我没有让Thymeleaf解析那个标签.我需要一些帮助:(
我一直在玩弹簧靴和百里香; 我正在尝试做一个表格,我将列出数字,用户将选择它们; 但是我想"检查"第三个元素(当等于3时)并且我看不到输入被检查.
我没有加载信息和显示复选框的问题,当我想在页面加载时默认选中其中一个时出现问题.
我需要一些帮助来确定它应该是什么问题,或者它是否是一个bug:checked属性.
我在控制器中有这个
@ModelAttribute("allFeatures")
public List<Integer> populateFeatures() {
return Arrays.asList(1, 2, 3, 4, 5, 6);
}
Run Code Online (Sandbox Code Playgroud)
这是html代码
<ul>
<li th:each="feat : ${allFeatures}">
<input type="checkbox" th:field="*{features}" th:value="${feat}" th:checked="${feat == 3}"></input>
<label th:for="${#ids.prev('features')}" th:text="${'seedstarter.feature.' + feat}">Electric Heating</label>
</li>
<li th:remove="all">
<input id="removed1" type="checkbox"/> <label for="removed1">Turf</label>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
提前致谢.