我想从头开始创建一个新的应用程序,可能会使用Spring MVC和Spring Web Flow.Spring Roo创建的项目使用Spring MVC和Web Flow.什么是视图技术的一些很好的替代品,或者是带有Spring和JSTL taglib和jQuery的JSP的方法?
我们使用maven作为我们的大型产品.我们的所有工件都使用maven部署目标部署到共享archiva存储库.我现在正在整合具有ant build的第三方产品.我知道如何使用antrun插件从maven调用ant目标,但我不确定如何在这个实例中设置pom.我不希望maven实际生成工件,但我确实希望它在运行maven部署目标时拉出由ant构建的工件.
我打算让pom与build.xml相邻.pom将使用包目标中的antrun插件在适当的时候调用ant目标来构建.war工件.
问题:
a)我正在创建一个.war文件,但它是通过ant而不是Maven创建的,所以在pom中使用war包装类型没有意义.我的包装类型应该是什么?
b)如何让maven从我的ant输出目录中提取工件以实现部署目标?
c)如果对A和B没有好的答案,那么是否有ant任务复制maven部署功能以将我的.war工件放入共享存储库?
我在亚马逊的ApiGateway创建了一个资源.它指向Lambda函数.这是受到本机移动应用程序(android和ios)的影响,它已经在野外.
我现在想要修改Lambda函数,但我认为无法将我的ApiGateway资源更改为指向lambda的别名.这是我第一次使用这些技术,我发现在aws控制台中没有简单的机制来管理它.
如何修改我的ApiGateway资源以指向我的lambda别名,以便我可以在不影响现有客户端的情况下编辑主干?
假设我有一个会议实体.每次会议都有一位与会者和一个会面日期.在我的会议桌内,我可能会为每位与会者举行多次会议,每次会议的日期各不相同.我需要一个JPA查询,它只为所有与会者选择最新的会议.例如,如果我的表看起来像这样
Meeting ID | Attendee ID | Meeting Date
1 | 1 | 6/1/2011
2 | 2 | 6/1/2011
3 | 1 | 6/6/2011
4 | 3 | 6/6/2011
Run Code Online (Sandbox Code Playgroud)
我的结果应该是
Meeting ID | Attendee ID | Meeting Date
2 | 2 | 6/1/2011
3 | 1 | 6/6/2011
4 | 3 | 6/6/2011
Run Code Online (Sandbox Code Playgroud)
使用JPA 2对抗postgres.会议有1-1参加者和一个简单的时间戳日期.我怀疑我需要做一个小组by和max(blah),也许是一个加入我自己,但我不确定最好的方法来解决这个问题.
更新: 在晚上玩这个之后,我仍然没有可接受的JPQL解决方案.这是我到目前为止:
select m from Meeting m
where m.meetingDate in
( select max(meet.meetingDate)
from Meeting meet group by meet.attendee )
Run Code Online (Sandbox Code Playgroud)
我有其他与此问题无关的其他条件,例如由与会部门过滤等等.这有效的唯一原因是因为我们将会议日期跟踪到第二(或更精细),并且在同一时间召开两次会议的可能性很小.我们正在为它们添加一些Java内容,以便只为每个与会者提供最后一次会议,以防我们同时获得两个会议,但这是一个非常糟糕的解决方案.在查询中获取所有内容真的不应该太难,但我还没弄明白.
Update2:添加sql标签,因为如果我需要使用sql创建一个视图并创建一个JPA对象来映射到视图我就可以了.
我正在使用jaxb从xml架构生成java类.模式导入XMLSchema.xsd,其内容用作文档中的元素.
如果我分别删除导入和对"xsd:schema"的引用,那么绑定编译器会成功生成类.如果我没有那么它会产生以下错误,如果我尝试仅从XMLSchema.xsd生成Java类,则会出现同样的错误!
> C:\Users\me>"%JAXB%/xjc" -extension -d tmp/uisocketdesc -p uis.jaxb uisocketdesc.xsd -b xml_binding_test.xml -b xml_binding_test_2.xml
-b xml_binding_test_3.xml
parsing a schema...
compiling a schema...
> [ERROR] A class/interface with the same name "uis.jaxb.ComplexType" is already in use. Use a class customization to resolve this conflict.
line 612 of "http://www.w3.org/2001/XMLSchema.xsd"
> [ERROR] (Relevant to above error) another "ComplexType" is generated from here.
line 440 of "http://www.w3.org/2001/XMLSchema.xsd"
> [ERROR] A class/interface with the same name "uis.jaxb.Attribute" is already in use. Use a class customization …Run Code Online (Sandbox Code Playgroud) 我整晚都在尝试使用Amazon S3预先签名的URL尝试PUT文件.我在java代码中生成预签名的URL.
AWSCredentials credentials = new BasicAWSCredentials( accessKey, secretKey );
client = new AmazonS3Client( credentials );
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest( bucketName, "myfilename", HttpMethod.PUT);
request.setExpiration( new Date( System.currentTimeMillis() + (120 * 60 * 1000) ));
return client.generatePresignedUrl( request ).toString();
Run Code Online (Sandbox Code Playgroud)
然后我想使用生成的预签名URL来使用curl PUT文件.
curl -v -H "content-type:image/jpg" -T mypicture.jpg https://mybucket.s3.amazonaws.com/myfilename?Expires=1334126943&AWSAccessKeyId=<accessKey>&Signature=<generatedSignature>
Run Code Online (Sandbox Code Playgroud)
我认为,就像GET一样,这可以在一个非公开的存储桶上工作(那是预先签名的,对吗?)好吧,我在每次尝试时都被拒绝访问.最后,出于沮丧,我改变了桶的许可,允许每个人写.当然,预先签名的URL有效.我迅速从桶中删除了每个人的权限.现在,我无权删除通过我自己预先签名的URL上传到我的存储桶中的项目.我现在看到我可能应该在我上传的内容上放置一个x-amz-acl标题.我怀疑在我做对话之前,我会创建几个不可修复的对象.
这导致了一些问题:
最终目标是移动电话将使用此预先指定的URL来PUT图像.我试图让它成为curl作为概念的证明.
更新:我在亚马逊论坛上提出了一个问题.如果在那里提供答案,我会在此处作为答案.
我正在寻找为自定义JSF 2复合组件库生成文档.复合组件未在任何faces-config.xml文件中引用,而是复合组件的.xhtml文件存储在META-INF/resources中,并使用新的composite:interface标签来定义接口.
对于JSP标记库,可以使用https://taglibrarydoc.dev.java.net/生成文档,我想知道我的JSF 2复合组件库是否有类似的东西.
documentation jsf facelets documentation-generation composite-component
我有一个用户实体:
@Entity
@Table( name = "bi_user" )
@SequenceGenerator( name = "USER_SEQ_GEN", sequenceName = "USER_SEQUENCE" )
public class User
extends DataObjectAbstract<Long>
{
private static final long serialVersionUID = -7870157016168718980L;
/**
* key for this instance. Should be managed by JPA provider.
*/
@Id
@GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "USER_SEQ_GEN" )
private Long key;
/**
* Username the user will use to login. This should be an email address
*/
@Column( nullable=false, unique=true)
private String username;
// etc. other columns and …Run Code Online (Sandbox Code Playgroud) 假设我有一个像这样的数据模型(伪代码):
@Entity
Person {
@OneToMany
List<PersonAttribute> attributes;
}
@Entity
PersonAttribute {
@ManyToOne
AttributeName attributeName;
String attributeValue;
}
@Entity
AttributeName {
String name;
}
Run Code Online (Sandbox Code Playgroud)
我有一个Spring-Data-JPA存储库,例如:
public interface PersonRepository extends PagingAndSortingRepository<Person, Long>, QueryDslPredicateExecutor<Person>{}
Run Code Online (Sandbox Code Playgroud)
我在QueryDSL文档中看到有一种从Person加入PersonAttribute的机制,但看起来你需要访问QueryDsl Query对象,而该对象是存储库的客户端所不具备的.
我想用Predicate做的是找到所有具有AttributeValue(有一个连接)的人,其值为"blue",而AttributeName(有另一个连接)的名称为"eyecolor".我不确定如何做到这一点any()并强制执行我只得到那些eye_color =蓝色而不是那些有shoe_color =蓝色的那些.
我希望我能做到这样的事情:
QPerson person = QPerson.person;
QPersonAttribute attribute = person.attributes.any();
Predicate predicate = person.name.toLowerCase().startsWith("jo")
.and(attribute.attributeName().name.toLowerCase().eq("eye color")
.and(attribute.attributeValue.toLowerCase().eq("blue")));
Run Code Online (Sandbox Code Playgroud)
但是any()在那里它只匹配任何属性值为"blue"的东西和任何具有"eye color"属性的东西,无论颜色如何. 如何使这些条件适用于集合中的相同属性?
我有一个简单的实体.我正在使用spring-data-jpa版本1.2.0.RELEASE和eclipselink 2.4.1.
@Entity
@Table(name="platform")
public class Platform {
@Id
@Column(name="id", nullable=false, updatable=false, insertable=true)
private Long id;
// etc.
}
Run Code Online (Sandbox Code Playgroud)
我想保存它.我的存储库看起来像
public interface PlatformRepository extends JpaRepository<Platform, Long> {
Platform findByName( String name );
}
Run Code Online (Sandbox Code Playgroud)
使用此方法,我的控制器非常简单
@RequestMapping(method=RequestMethod.POST, produces="application/json")
public Platform post( Platform platform ) {
Platform result = platformDao.saveAndFlush(platform);
return result;
}
Run Code Online (Sandbox Code Playgroud)
而这种方法的反应是
{"platform":{"id":null,"name":"Test1"}}
Run Code Online (Sandbox Code Playgroud)
从平台中选择*显示Test1的ID为6.该表定义为:
create table platform(
id int not null auto_increment primary key,
name varchar(128) not null);
Run Code Online (Sandbox Code Playgroud)
我希望在保存后设置ID,但事实并非如此.他们在编写实体后不会期望我立即进行查找,对吧?
java ×7
jpa ×2
spring-data ×2
amazon-s3 ×1
ant ×1
aws-lambda ×1
curl ×1
eclipselink ×1
facelets ×1
jaxb ×1
jpa-2.0 ×1
jpql ×1
jsf ×1
jsp ×1
maven-2 ×1
querydsl ×1
spring ×1
spring-mvc ×1
sql ×1