我们的政策是只构建1个可部署的jar.所有特定于环境的配置都是分开的,我们一起构建它们.所以在我们当前的Ant流程中,我们为每个环境都有一个属性文件,循环遍历它们,并为每个环境创建一组配置文件.
在我目前的POM XML中,我只能在命令行中构建一个配置文件.是否可以通过Maven实现?
以下是POM.xml的一些相关部分
<!-- Define profiles here and make DEV as default profile -->
<profiles>
<!-- dev Profile -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<!-- qa Profile -->
<profile>
<id>qa</id>
<properties>
<env>qa</env>
</properties>
</profile>
<!-- prod Profile -->
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
</profile>
</profiles>
...
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<filters>
<filter>env/${env}.properties</filter>
</filters>
<outputDirectory>${project.build.directory}/config/${env}
</outputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/config/default
</directory>
<includes>
<include>*.xml</include>
<include>*.properties</include>
</includes>
</resource>
Run Code Online (Sandbox Code Playgroud)
.....
谢谢,Prabhjot
我正在使用JSR303并创建了一个类级别约束,用于比较表单中的密码及其确认,我将在此处命名为@SameAs约束.理想情况下,我希望将约束与预期目标(confirmPassword)相关联,但显然封闭bean不可用于提取密码prop. - 因此是类级约束.
我有兴趣阅读其他帖子,演示如何利用类级别约束来验证关系,但找不到任何解释如何定制约束违规以与子路径相关联的内容,在这种情况下是两个字段之一在关系中.
我的问题如下:如何将约束违规的消息与'confirmPassword'字段而不是顶级对象相关联?我试图使用javax.Validator.validate(target,context)的上下文参数,但在@SameAs的验证器中添加一个Node会导致级联中的下一个约束的异常(尝试提取confirmPassword - > orderNumber属性)而不是order - > orderNumber)作为结果.
目前,我已经通过创建一个存储约束消息的额外属性来使用丑陋的kludge,该消息被拔出以供在web层上的confirmPassword输入字段附近使用.
当然我在这里遗漏了一些东西....请看下面的例子
谢谢你的评论
例
@Constraint( validatedBy = { SamePwdAsValidator.class})
public interface SamePwdAs {//...
}
//Using passwords in an order doesn't make sense - only for demo purpose
@SamePwdAs( message = "Password and confirmation must match" ...)
public class Order {
@NotNull
@Size(....)
String pwd;
//where I would really like to use @SameAs, and associate a violation
String pwdConfirm;
@NotNull (...)
@Pattern (....)
String orderNumber;
//...getters/setters
}
public class SamePwdAsValidator …Run Code Online (Sandbox Code Playgroud) 我对Android中的服务有疑问.我想知道从GPS获取Location变量的最佳方法是什么.我正在使用一个实现GPS模块的服务进行地理定位的应用程序.为了获取位置,我在类静态和公共方法静态中创建一个变量,从类外部调用,就是这样.要从我在课堂上使用的GPS中检索位置:
位置mLocation = ServiceGPS.getLocation(); ServiceGPS类具有以下方法:
public static Location getLocation(){return mLocation; }
在这种情况下,我真的没有看到绑定到服务的重点,因为我只需要调用静态方法.我也在考虑做一个基类或实现LocationListener,但这种方式非常简单,它可以工作并节省代码写入.
非常感谢您的帮助,并与我分享您的知识.
BR.大卫.
我已经使用Spring MVC一段时间了,现在为JSP页面添加了带注释的控制器.我有一个类似这样的类:
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
public class AdminController {
@RequestMapping(value = "/doStuff1.htm", method = RequestMethod.POST)
public void doStuff1(@RequestParam("password")String password) {
// do some stuff
}
@RequestMapping(value = "/doStuff2.htm", method = RequestMethod.POST)
public void doStuff2(
@RequestParam("password")String password,
@RequestParam("foo")String foo{
// do some stuff
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,每个调用都会传入密码参数.密码从对话框中读取并传递到每个提交的调用中.
我想从方法调用中删除密码参数以获得"更干净"的代码.
我为此目的快速浏览了Spring安全性,但它似乎有点重量级.也许可以使用AOP?
有一个明显的解决方案我错过了吗?
非常感谢, - 斯科特
我在MySQL Workbench中处理一个中等复杂的模式,EER图的单页现在已经满了.有谁知道如何将它扩大到两页或更多页面?
当我尝试使用.htaccess创建从HTTP页面重定向到HTTPS页面(仅针对特定页面)的规则时,我收到了循环重定向.我哪里错了?
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^(/doctor) [NC, OR]
RewriteCond %{REQUEST_URI} ^(/client)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(/doctor) [NC, OR]
RewriteCond %{REQUEST_URI} !^(/client)
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L]
Run Code Online (Sandbox Code Playgroud) 假设我有一些不同类型的变量.
int MyInteger;
double MyDouble;
char MyChar;
Run Code Online (Sandbox Code Playgroud)
这些变量的指针存储在一个void指针数组中.
void* IntegerPointer = &MyInteger;
void* DoublePointer = &MyDouble;
void* CharPointer = &MyChar;
void* PointerArray[] = {IntegerPointer, DoublePointer, CharPointer};
Run Code Online (Sandbox Code Playgroud)
我想将数据类型信息存储在并行数组中. type_info似乎适合该任务,但不支持赋值.所以我不能只做这样的事情:
type_info TypeInfoArray[] = {int, double, char};
Run Code Online (Sandbox Code Playgroud)
有没有其他方法来存储有关数据类型的信息?
我想创建一个用于Firefox工具栏的书签,prompt一旦点击就会打开一个JavaScript 窗口,并要求用户输入.
首先,这可能吗?
其次,如何将JS输入字段提交到特定的PHP页面进行处理?
谢谢
只是想知道,由于 Android 应用程序是 Java 程序,是否有可能在不使用 SDK 的情况下完全从头开始编写一个应用程序?如果不是,那为什么不呢?
我是jquery的新手.我有一些功能,我有两个textarea盒子,让我们假设
第一个textarea id是first_ta,第二个textarea id是second_ta
<textarea id="first_ta" rows="2" cols="2"></textarea>
<textarea id="second_ta" rows="2" cols="2"></textarea>
Run Code Online (Sandbox Code Playgroud)
1. 我希望first_ta的内容在"p"标签中,标签应该由jquery本身生成.
2.我希望second_ta的内容在一个应该由jquery生成的"div"标签中,如果我重复这个过程,div的id应该动态改变.
请帮我找到上面的解决方案.