有没有办法用自动属性做到这一点?
private IList<string> List;
public IList<String> list
{
get { return List.ToList().AsReadOnly(); }
set { List = value; }
}
Run Code Online (Sandbox Code Playgroud) 我建立一个小的Windows服务(不是一个Web服务)定期检查一些数据并基于此并调用类库来做一些工作
顺便说一句:这是我第一次尝试创建Windows服务
如何在运行时检查C#应用程序是Windows应用程序还是控制台应用程序?
我想写一个通用输出库(在控制台应用程序时输出到文本框或控制台).
出于这个原因,如果我可以检查它是否是一个asp应用程序也是有用的.
有没有办法创建这样的路线" http:// mysite/Username "?
我是maven的新手,我收到了这个错误:
SEVERE: SLF4J: Class path contains multiple SLF4J bindings.
SEVERE: SLF4J: Found binding in [jar:file:/.../WEB-INF/lib/slf4j-jdk14-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SEVERE: SLF4J: Found binding in [jar:file:/.../WEB-INF/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SEVERE: SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SEVERE: SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6]
SEVERE: SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
SEVERE: Exception while preparing the app
SEVERE: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
Run Code Online (Sandbox Code Playgroud)
所以我在想的是我需要摆脱这个slf4j-jdk14-1.5.8.jar.是否有可能或有任何其他解决方案.这是我在pom文件中的依赖项:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId> …Run Code Online (Sandbox Code Playgroud) 我有实体项目和实体集群。一个项目可以有多个集群。我不想要第三个表来保存这种关系。只是保存到集群的项目 ID。
这是我的项目实体:
@Entity
@Table(name = "Project")
public class Project {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String projectName;
@OneToMany
@JoinTable(name = "cluster")
private Set<Cluster> clusters;
}
Run Code Online (Sandbox Code Playgroud)
这是我的集群实体
@Entity
@Table(name = "Cluster")
public class Cluster {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String team;
private String concept;
}
Run Code Online (Sandbox Code Playgroud)
这给了我错误:必须具有与引用的主键相同的列数。
我该如何解决这个问题?我不知道如何解决这个问题。