小编Cza*_*zar的帖子

如何使用系统环境变量作为@PropertySource值的一部分?

我想用我的启动程序java ... -Denv=prod ... ,并有

@PropertySource("classpath:/settings/$idontknowwhat$/database.properties")`
Run Code Online (Sandbox Code Playgroud)

读取属性文件: /settings/prod/database.properties

我尝试过使用#{systemProperties['env']}但是没有解决异常:

Could not open ServletContext resource ['classpath:/settings/#{systemProperties['env']}/database.properties]
Run Code Online (Sandbox Code Playgroud)

java spring

11
推荐指数
1
解决办法
8815
查看次数

如何在 IntelliJ 同步上传递 gradle 参数

编辑:

事实证明这不是一个错误,而是我的配置错误。

原问题

由于IntelilJ 中的这个错误我必须添加

configurations {
    all {
        exclude(group = "ch.qos.logback", module = "logback-classic")
    }
}
Run Code Online (Sandbox Code Playgroud)

在 IntelliJ gradle 同步期间,不要忘记删除它。

有没有办法在 IntelliJ 同步上将参数传递给 gradle?我可以有这样的东西:

if (project.hasProperty("intellijHack"))
    configurations {
        all {
            exclude(group = "ch.qos.logback", module = "logback-classic")
        }
    }
Run Code Online (Sandbox Code Playgroud)

intellij-idea gradle

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

没有用户服务的Spring Security X.509身份验证

我在我的Web应用程序中使用Spring Security(v3.1.3)进行X.509身份验证.用户和角色存储在数据库中,但我实际上并不需要这样做,因为客户端证书的CN符合"[ROLE] - [USERNAME]"模式,这意味着我已经拥有证书本身的用户名和角色.那么如何在不费力的情况下消除数据库呢?我应该编写自己的用户服务实现,这将填充UserDetails,还是有更优雅的方法?

authentication spring-security client-certificates x509certificate x509

4
推荐指数
1
解决办法
2967
查看次数

如何通过camel spring DSL发送文件作为邮件附件

我在我们当前的项目中使用Camel 2.9.x进行集成.其中一个路由由两个端点组成 - 文件轮询端点和smtp邮件端点.必须通过smtp端点作为附件发送第一个端点生成的文件.

对于Camel配置,我们使用Spring DSL(这实际上是一个要求).Spring版本是3.1.1.不幸的是,我发现只有java dsl示例和将文件附加到camel路由中的电子邮件的文档.

<endpoint uri="file:///path/to" id="file-source"/>
<endpoint uri="smtp://mail.example.com:25/?username=someuser@example.com&amp;password=secret&amp;to=recv@example.com" id="mail-dest"/>
<route id="simplified-for-readability">
  <from ref="file-source"/>
  <to ref="mail-dest"/>
</route>
Run Code Online (Sandbox Code Playgroud)

此配置将文件作为普通/文本正文发送,而不是作为附件(甚至二进制文件)发送.有没有办法在不使用Java dsl的情况下将文件作为附件发送?

java spring apache-camel

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