小编aea*_*Dev的帖子

使用Spring Boot进行Maven资源过滤:无法解析占位符

Java和Maven的新手,但我试图让Maven处理数据库连接属性,这样我就可以让maven构建在dev/stage/prod环境之间进行更改,我遇到了过滤和资源问题.不知道我在这里做错了什么.

POM文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.comapny</groupId>
<artifactId>reporting</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>reporting</name>
<url>http://maven.apache.org</url>

<properties>
    <db.jdbcUrl>jdbc:aURL</db.jdbcUrl>
    <db.jdbcUn>aUser</db.jdbcUn>
    <db.jdbcPw>aPassword</db.jdbcPw>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <springframework.version>4.2.3.RELEASE</springframework.version>
    <springframework.jdbc.version>4.1.4.RELEASE</springframework.jdbc.version>
    <hadoop.version>2.7.1.2.3.4.2-1</hadoop.version>
    <hbase.version>1.1.2.2.3.4.2-1</hbase.version>
    <phoenix.version>4.4.0.2.3.4.2-1</phoenix.version>
    <junit.version>4.12</junit.version>
    <mail.version>1.4.3</mail.version>
</properties>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.0.RELEASE</version>
</parent>

<repositories>
    <repository>
        <id>github-releases</id>
        <url>http://oss.sonatype.org/content/repositories/github-releases/</url>
    </repository>
    <repository>
        <id>clojars.org</id>
        <url>http://clojars.org/repo</url>
    </repository>
    <repository>
        <id>hortonworks</id>
        <url>http://repo.hortonworks.com/content/repositories/releases/</url>
    </repository>
    <repository>
        <id>twitter4j</id>
        <url>http://twitter4j.org/maven2</url>
    </repository>
</repositories>

<dependencies>

    <!-- <dependency> <groupId>jdk.tools</groupId> <artifactId>jdk.tools</artifactId> 
        <version>1.7.0_05</version> <scope>system</scope> <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath> 
        </dependency> -->

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <!-- <version>1.2.3.RELEASE</version> -->
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.9.1</version>
    </dependency> …
Run Code Online (Sandbox Code Playgroud)

java spring maven spring-boot

37
推荐指数
1
解决办法
7908
查看次数

MongoDB自定义序列化程序,以避免添加_t集合,引发ReadEndArray错误?

情况:语言:使用C#驱动程序的C#我有一个包含List作为属性的模型。该列表可以包含全部继承BaseModelClass的3个不同模型之一。为了帮助序列化这种情况,Mongo添加了_t来标识实际使用的模型。对于我们来说,这是一个问题,原因是_t占用了很多空间。我是一个低级的开发人员,我要求提供更多的空间和内存,他们告诉我无需额外的空间即可解决。因此,我坐下来编写了一个自定义的序列化程序,该序列化程序可以处理不同的类型,而无需在BSONDocument中写入_t。在开始对序列化进行单元测试之前,我认为一切都很好。我开始得到“只有在ContextType为Array时才能调用ReadEndArray,而在ContextType为Document时不能调用”。

任何意见或建议,不胜感激。

这是我到目前为止的代码...

<---------收集模型--------------------->

[BsonCollectionName("calls")]
[BsonIgnoreExtraElements]
public class Call
{
    [BsonId]
    public CallId _id { get; set; }

    [BsonElement("responses")]
    [BsonIgnoreIfNull]
    public IList<DataRecord> Responses { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

<----------基础数据记录------------------>

[BsonSerializer(typeof(DataRecordSerializer))]
public abstract class DataRecord
{
    [BsonElement("key")]
    public string Key { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

<-----------实际数据记录的示例----------------->

[BsonSerializer(typeof(DataRecordSerializer))]
public class DataRecordInt : DataRecord
{
    [BsonElement("value")]
    public int Value { get; set; }
}

[BsonSerializer(typeof(DataRecordSerializer))]
public class DataRecordDateTime : DataRecord
{
    [BsonElement("value")]
    public DateTime? Value { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

<---------------触发解串器的单元测试----------------->

        //Arrange
        var …
Run Code Online (Sandbox Code Playgroud)

c# serialization mongodb mongodb-.net-driver

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