我刚刚在另一个问题中看到了这段奇怪的代码.我认为这会导致StackOverflowError被抛出,但它不会......
public class Node {
private Object one;
private Object two;
public static Node NIL = new Node(Node.NIL, Node.NIL);
public Node(Object one, Object two) {
this.one = one;
this.two = two;
}
}
Run Code Online (Sandbox Code Playgroud)
我认为它会爆炸,因为Node.NIL引用它自己构建.
我无法弄明白为什么它没有.
我一直在努力用Spring-Security 正确实现Stomp(websocket)身份验证和授权.对于后代,我会回答我自己的问题,提供指导.
Spring WebSocket文档(用于身份验证)看起来不清楚ATM(恕我直言).我无法理解如何正确处理身份验证和授权.
Principal在控制器可用.我是node.js和java脚本的新手,我找不到这个".on"关键字的含义.当我用另一个单词代码更改失败时.
var req = http.get("http://www.google.com", function(res) {
console.log("Got response: " + res.statusCode);
res.on('data', function (chunk) {
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用这个blibioteca android-maps-extensions,因为我需要在我的地图上修复超过1000个标记.
在我的项目中添加了项目依赖项:
compile project (':android-maps-extensions')
Run Code Online (Sandbox Code Playgroud)
但是当我更新build.gradle时会出现以下错误:
没有这样的属性:对于类sonatypeUserName:org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
用户名和密码似乎不正确或者其他什么,这段代码是我正在构建的项目的一部分.如何库,如何库:
...
pom.project {
name 'Android Maps Extensions'
description 'Library extending capabilities of Google Maps Android API v2'
inceptionYear '2013'
url 'http://AndroidMapsExtensions.com'
packaging 'aar'
developers {
developer {
name 'Maciej Górski'
id 'mg6maciej'
email 'maciek.gorski@gmail.com'
url 'http://mg6.pl'
}
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/mg6maciej/android-maps-extensions'
connection 'scm:git:https://github.com/mg6maciej/android-maps-extensions.git'
developerConnection 'scm:git:https://github.com/mg6maciej/android-maps-extensions.git'
}
}
...
Run Code Online (Sandbox Code Playgroud)
有什么建议 ?
是否可以以一种不被一组配置文件使用的方式配置bean?目前我可以这样做(我相信):
@Profile("!dev, !qa, !local")
Run Code Online (Sandbox Code Playgroud)
是否有更简洁的符号来实现这一目标?我们假设我有很多个人资料.另外,如果我有一个Mock和一些服务(或其他)的具体实现,我可以只注释其中一个,并假设另一个将用于所有其他情况?换句话说,这是必要的:
@Profile("dev, prof1, prof2")
public class MockImp implements MyInterface {...}
@Profile("!dev, !prof1, !prof2") //assume for argument sake that there are many other profiles
public class RealImp implements MyInterface {...}
Run Code Online (Sandbox Code Playgroud)
我可以只注释其中一个,并@Primary在另一个上添加注释吗?
本质上我想要这个:
@Profile("!(dev, prof1, prof2)")
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我们有以下字符串,它是写入HDFS上文件的有效JSON.
{
"id":"tag:search.twitter.com,2005:564407444843950080",
"objectType":"activity",
"actor":{
"objectType":"person",
"id":"id:twitter.com:2302910022",
"link":"http%3A%2F%2Fwww.twitter.com%2Fme7me4610012",
"displayName":"",
"postedTime":"2014-01-21T11:06:06.000Z",
"image":"https%3A%2F%2Fpbs.twimg.com%2Fprofile_images%2F563125491159162881%2FfypkHK3M_normal.jpeg",
"summary":"???????????????????? ????????????? ??????????????? ???? ???????????????? ?????? ????? ??????????? lloooo_20",
"links":[
{
"href":null,
"rel":"me"
}
],
"friendsCount":10503,
"followersCount":10325,
"listedCount":12,
"statusesCount":84957,
"twitterTimeZone":null,
"verified":false,
"utcOffset":null,
"preferredUsername":"me7me4610012",
"languages":[
"ar"
],
"favoritesCount":17
},
"verb":"share",
"postedTime":"2015-02-08T12:56:35.000Z",
"generator":{
"displayName":"Twitter for Android",
"link":"http%3A%2F%2Ftwitter.com%2Fdownload%2Fandroid"
},
"provider":{
"objectType":"service",
"displayName":"Twitter",
"link":"http%3A%2F%2Fwww.twitter.com"
},
"link":"http%3A%2F%2Ftwitter.com%2Fme7me4610012%2Fstatuses%2F564407444843950080",
"body":"RT @sckud1: ?????: ???? ???? ???? ?????? ??? ??? ???? ??? ???? ?? ????? ???? ????? ?????: ????? http%3A%2F%2Ft.co%2FC55SaQKmUV http%3A%2F%2Ft.co%2Ft5TjIln…",
"object":{
"id":"tag:search.twitter.com,2005:564407126526013440",
"objectType":"activity",
"actor":{
"objectType":"person",
"id":"id:twitter.com:462268717",
"link":"http%3A%2F%2Fwww.twitter.com/sckud1", …Run Code Online (Sandbox Code Playgroud) 我有一个使用 JPA 的 Spring Boot 应用程序,它有 2 个数据源,1 个用于 DB2,1 个用于 SQL Server。
当我尝试将实体保存到 SQL Server 时,没有抛出任何错误,但实体不会持久化到数据库中。我没有看到日志中生成了插入。
提前致谢
这是我执行以尝试保存实体的代码。@成分
public class TestSave {
@Autowired
private BeercupMessageLogRepository repository;
@Scheduled(fixedRate = 500000)
public void reportCurrentTime() {
System.out.println("Testing Save ... ");
// Save the message in the transaction log - TypeId = 1 for Quote
BeercupMessageLog beercupMessage = new BeercupMessageLog(1,"THIS IS A TEST ...", false);
beercupMessage = repository.save(beercupMessage);
System.out.println("Testing save complete ....");
}
}
Run Code Online (Sandbox Code Playgroud)
这里是sql Server配置。
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages="com.xxx.beverage.repository.sqlserver",entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = …Run Code Online (Sandbox Code Playgroud) 假设我有一个Shelf班级,每个班级Shelf都有多个Book.
public class Shelf{
private String shelfCode;
private ArrayList<Book> books; //add getters, setters etc.
}
public class Book{
private String title;
}
Run Code Online (Sandbox Code Playgroud)
现在,让我们从一些方法,我有发言权List的ShelfS,每个都包含了一些书.如何使用stream收集此列表中的所有书籍?
List<Shelf> shelves = new ArrayList<Shelf>();
Shelf s1 = new Shelf();
s1.add(new Book("book1"));
s1.add(new Book("book2"));
Shelf s2 = new Shelf();
s1.add(new Book("book3"));
s1.add(new Book("book4"));
shelves.add(s1);
shelves.add(s2);
List<Book> booksInLibrary = //??
Run Code Online (Sandbox Code Playgroud)
我在想类似的东西
List<Book> booksInLibrary =
shelves.stream()
.map(s -> s.getBooks())
.forEach(booksInLibrary.addall(books));
Run Code Online (Sandbox Code Playgroud)
但它似乎不起作用,抛出编译错误.
我有这个正则表达式:
/(((\w+)|(\.\w+)|(\#\w+)|\*)(\[(.+(=".+"|\*".+"|\^".+"|))\])?(::|:)?)+(?=[ \S]*\{)/gm
我试图用来匹配CSS选择器.考虑这个伪代码CSS输入:
.main {
property: value;
}
.one, .two a[href$=".com"] {
.subclass {
property: value;
}
}
.test:before, .test:after:active {}
Run Code Online (Sandbox Code Playgroud)
上面的模式将返回以下匹配:
['.body', '.one', '.two', 'a[href$=".com"]', '.subclass', '.test:before', '.test:after:active']
Run Code Online (Sandbox Code Playgroud)
我试图修改模式,以便psuedo选择器不匹配.因此所有其他匹配应该仍然有效,但.test:before应该只是.test也.test:after:active应该匹配.test.如果没有负面的后视,或者如果第一个角色是一个不匹配的方法,我想不出这样做的方法:.
我在Node中实现这个,我不想将我的脚本锁定到Node> 9.2.0只是为了在我的正则表达式中使用负面的后台.
任何想法将不胜感激!
我正在构建我的第一个 Springboot 2.0 应用程序。我试图将我的 Springboot 应用程序放入一个 docker 容器,将我的 PostgresDB 放入另一个容器中。
我的 Dockerfile
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD springboot-api-demo-0.1*.jar app.jar
RUN sh -c 'touch /app.jar'
EXPOSE 9443
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/urandom -jar /app.jar" ]
Run Code Online (Sandbox Code Playgroud)
我的 docker-compose.yml 文件
version: "2.1"
services:
springboot-api-demo:
image: "fw/springboot-api-demo"
mem_limit: 1024m
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=local
- AWS_REGION=local
- ENVIRONMENT=local
- AUTH_ENABLED=false
postgres:
container_name: pgdb
image: postgres:9.6-alpine
environment:
- 'POSTGRES_ROOT_PASSWORD=postgres'
- 'POSTGRES_USER=postgres'
- 'POSTGRES_PASSWORD=postgres'
ports:
- "54321:5432"
Run Code Online (Sandbox Code Playgroud)
我在application.properties 中使用 Springboot JPA …
java ×5
spring ×3
spring-boot ×3
javascript ×2
android ×1
cloudera ×1
config ×1
docker ×1
google-maps ×1
hibernate ×1
jackson ×1
java-stream ×1
lookbehind ×1
node.js ×1
postgresql ×1
regex ×1
spring-data ×1
websocket ×1