我有兴趣以编程方式更改Log4j2中的日志级别.我试着查看他们的配置文档,但似乎没有任何东西.我也试着查看包裹:org.apache.logging.log4j.core.config但是那里的任何东西看起来都没有帮助.
我想编写一个Spring Data JPA存储库接口方法签名,它可以让我找到在该实体中具有嵌入对象属性的实体.有谁知道这是否可能,如果是这样的话怎么样?
这是我的代码:
@Entity
@Table(name = "BOOK_UPDATE_QUEUE", indexes = { uniqueConstraints = @UniqueConstraint(columnNames = {
        "bookId", "region" }, name = "UK01_BOOK_UPDATE_QUEUE"))
public class QueuedBook implements Serializable {
    @Embedded
    @NotNull
    private BookId bookId;
    ...
}
@Embeddable
public class BookId implements Serializable {
    @NotNull
    @Size(min=1, max=40)
    private String bookId;
    @NotNull
    @Enumerated(EnumType.STRING)
    private Region region;
    ...
}
public interface QueuedBookRepo extends JpaRepository<QueuedBook, Long> {
    //I'd like to write a method like this, but can't figure out how to search by region,
    //when …Run Code Online (Sandbox Code Playgroud) 我对Angular.js有点了解,但我现在想自己教Dart和Angular.dart.不过,我有点好奇两者之间的区别是什么.Angular.dart教程明确表示不会比较这两者.使用过两者的人是否都对差异有所了解?
我想使用ng-click来执行多个表达式.我想在模型上设置一个值,并从中调用一个方法$scope,如下所示:
<a ng-click="navigation.book = book && bookSvc.showBook(book)" href="#{{book.id}}">{{book.title}}</a>
Run Code Online (Sandbox Code Playgroud)
我在哪里&&分离了我想要执行的两个不同的表达式.我知道我可以添加一个在控制器中执行这两项操作的方法.我应该这样做,还是有办法直接从里面执行两个表达式ng-click?
在Intellij 13中,主代码窗口显示了我所有的开放类(它们的名称流向多行),但现在在Intellij 14中它显示了一个小的下拉列表并且只显示在一行上.有没有我可以更改的设置让它再次流向多行?
我似乎无法访问Eclipse市场.我正在使用Juno 4.2.我尝试删除eclipse并删除所有插件,删除我的.metadata,并删除eclipse应用程序数据.
我已经尝试将我的默认浏览器从firefox切换到chrome,我尝试打开并完全关闭Windows防火墙.我在家.
不过,我能够获得eclipse更新.当我尝试报告市场的错误时,我得到了一个不同的错误.
当我尝试连接时,我收到了很多错误.
第一个是警告:
Connection to http://marketplace.eclipse.org/catalogs/api/p failed on Connection reset. Retry attempt 0 started
Run Code Online (Sandbox Code Playgroud)
第二个是错误:
Cannot install remote marketplace locations.: 
Run Code Online (Sandbox Code Playgroud)
第三是另一个错误:
Unexpected exception
Run Code Online (Sandbox Code Playgroud)
以下是接收顺序的堆栈跟踪:
java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:189)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
    at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
    at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
    at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
    at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
    at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
    at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
    at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer$GzipGetMethod.execute(HttpClientRetrieveFileTransfer.java:120)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
    at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer.performConnect(HttpClientRetrieveFileTransfer.java:1129)
    at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientRetrieveFileTransfer.openStreams(HttpClientRetrieveFileTransfer.java:699)
    at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.sendRetrieveRequest(AbstractRetrieveFileTransfer.java:879)
    at org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer.sendRetrieveRequest(AbstractRetrieveFileTransfer.java:570)
    at org.eclipse.ecf.provider.filetransfer.retrieve.MultiProtocolRetrieveAdapter.sendRetrieveRequest(MultiProtocolRetrieveAdapter.java:106)
    at org.eclipse.equinox.internal.p2.transport.ecf.FileReader.sendRetrieveRequest(FileReader.java:422)
    at org.eclipse.equinox.internal.p2.transport.ecf.FileReader.read(FileReader.java:273)
    at org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport.stream(RepositoryTransport.java:172)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写单元测试,为此我正在为Mockito模拟写一个when语句,但我似乎无法通过eclipse来识别我的返回值是有效的.
这是我正在做的事情:
Class<?> userClass = User.class;
when(methodParameter.getParameterType()).thenReturn(userClass);
Run Code Online (Sandbox Code Playgroud)
返回类型.getParameterType()是Class<?>,所以我不明白为什么eclipse说,The method thenReturn(Class<capture#1-of ?>) in the type OngoingStubbing<Class<capture#1-of ?>> is not applicable for the arguments (Class<capture#2-of ?>).它提供了投射我的userClass,但这只是让一些乱码的东西eclipse说它需要再次施放(并且不能施放).
这只是Eclipse的一个问题,还是我做错了什么?
感觉就像java 8流和映射函数那么冗长,它们并不是真正的改进.例如,我编写了一些使用集合生成另一个修改过的集合的代码:
private List<DartField> getDartFields(Class<?> model) {
    List<DartField> fields = new ArrayList<>();
    for (Field field : model.getDeclaredFields()) {
        if (!Modifier.isStatic(field.getModifiers())) {
            fields.add(DartField.getDartField(field));
        }
    }
    return fields;
}
Run Code Online (Sandbox Code Playgroud)
这似乎是java 8流及其功能的理想用例,所以我重写了它:
private List<DartField> getDartFields(Class<?> model) {
    return Arrays.asList(model.getDeclaredFields())
            .stream()
            .filter(field -> !Modifier.isStatic(field.getModifiers()))
            .map(field -> DartField.getDartField(field))
            .collect(Collectors.toList());
}
Run Code Online (Sandbox Code Playgroud)
但我不确定我更喜欢那个.这是236个字符,而普通风格的java则是239个字符.它似乎没有或多或少可读.这是很好,你没有申报ArrayList,但需要打电话.collect(Collectors.toList())和Arrays.asList(取决于数据类型)是没有任何好转.
使用.stream()这样的东西是否有一些实际的改进,我只是没有得到,或者这只是一个有趣的方式抛出任何同事不知道函数式编程的循环?
我想如果我动态地传递过滤器或映射lambdas它会很有用,但如果你不需要这样做......
我有一个只使用Android SDK的项目,而不是NDK,但每当我使用gradle构建NDK时,我都会收到警告:
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /usr/local/opt/android-sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
似乎是一个非常明确的警告.我没有使用ndk,所以ndk-bundle我没有android-sdk.问题是我没有ANDROID_NDK_HOME设置,我的local.properties文件(似乎是由Android Studio生成)没有设置NDK:
sdk.dir=/usr/local/opt/android-sdk
我有一个ANDROID_HOME环境变量:
ANDROID_HOME=/usr/local/opt/android-sdk
System是一个mac,但我们似乎在Docker中遇到了同样的问题.有谁知道如何摆脱这个警告?
java android android-ndk android-sdk-tools android-gradle-plugin
我正在用Spring Data JPA和Kotlin编写Spring Boot应用程序,我注意到CrudRepository有以下方法:
Optional<T> findById(ID id);
Run Code Online (Sandbox Code Playgroud)
不过,我正在使用Kotlin,它有更流畅的处理空值的方法Optional.有谁知道如何将这种方法转换成这样的工作?
fun findById(id: ID): T?
Run Code Online (Sandbox Code Playgroud)
当我扩展Repository自己并使用该签名创建一个repo时,我得到错误:
java.lang.ClassCastException: java.util.Optional cannot be cast to com.books.Book
Run Code Online (Sandbox Code Playgroud) java ×6
angularjs ×2
android ×1
android-ndk ×1
angular-dart ×1
dart ×1
eclipse ×1
intellij-14 ×1
java-8 ×1
java-stream ×1
javascript ×1
jpa ×1
junit ×1
kotlin ×1
log4j2 ×1
mockito ×1
spring ×1
spring-boot ×1
spring-data ×1