Skip to content

Instantly share code, notes, and snippets.

View snicoll's full-sized avatar
🍃
👨‍💻

Stéphane Nicoll snicoll

🍃
👨‍💻
View GitHub Profile
@snicoll
snicoll / config-metadata.json
Last active August 29, 2015 14:03
Spring boot autoconfigure metadata file (work in progress)
{"groups": {
"spring.mobile.devicedelegatingviewresolver": {
"type": "org.springframework.boot.autoconfigure.mobile.DeviceDelegatingViewResolverProperties",
"items": {
"mobileSuffix": {
"groupType": 0,
"type": "java.lang.String"
},
"normalSuffix": {
"groupType": 0,
{"groups": [
{
"name": "endpoints.shutdown",
"id": "endpoints.shutdown",
"type": "org.springframework.boot.actuate.endpoint.ShutdownEndpoint",
"items": [
{
"name": "id",
"id": "endpoints.shutdown.id",
"type": "java.lang.String"
{
"spring.datasource": {
"items": {
"maxIdle": {
"type": "java.lang.Integer",
"groupTypes": [
1,
3
]
},
@ConfigurationProperties(prefix = "spring.feature.foo")
public class FooProperties {
private Map<String, String> properties = new HashMap<String, String>();
public Map<String, String> getProperties() {
return this.properties;
}
public void setProperties(Map<String, String> properties) {
@snicoll
snicoll / gist:6a3ad69770b578bae6cd
Created October 31, 2014 15:12
New Spring init command in 1.2.0.RC1 allows you to initialize a project from the command line
➜ test spring init -d=web,actuator --extract
Using service at https://start.spring.io
Project extracted to '/private/tmp/test'
➜ test mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
{
"_links": {
"maven-build": {
"href": "https://start.spring.io/pom.xml?style={dependencies}{&packaging,type,javaVersion,languages,bootVersion}",
"templated": true
},
"maven-project": {
"href": "https://start.spring.io/starter.zip?style={dependencies}{&packaging,type,javaVersion,languages,bootVersion}",
"templated": true
},
public interface Machin<T> {}
// Pas de generics du tout
public class StringMachin implements Maching<String> {}
// Possible de résoudre le type generique en "resolvant" le type sur base de l'interface (java.lang.Class#getGenericInterfaces())
public class StringMachin<T extends Number> implements Machin<T> {}
public class Brol<T> {}

Application events are available since the very beginning of the Spring framework as a mean for loosely coupled components to exchange information. One of the most well known usage of application events is the following:

@Component
public class MyListener 
        implements ApplicationListener<ContextRefreshedEvent> {
  
    public void onApplicationEvent(ContextRefreshedEvent event) {
        ...
 }
@snicoll
snicoll / blog.md
Last active August 29, 2015 14:15

Application events are available since the very beginning of the Spring framework as a mean for loosely coupled components to exchange information. One of the most well known usage of application events is the following:

@Component
public class MyListener 
        implements ApplicationListener<ContextRefreshedEvent> {
  
    public void onApplicationEvent(ContextRefreshedEvent event) {
        ...
 }
2015-02-11 13:56:48,862 [88319227] ERROR - tartup.impl.StartupManagerImpl - Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
com.intellij.openapi.project.IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
at com.intellij.util.indexing.FileBasedIndexImpl.a(FileBasedIndexImpl.java:854)
at com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate(FileBasedIndexImpl.java:803)
at com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate(FileBasedIndexImpl.java:787)
at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:250)
at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:238)
at com.intellij.psi.stubs.StubIndex.process(StubIndex.java:76)
at com.intellij.psi.stubs.StubIndex.process(StubIndex.java:95)
at com.intellij.psi.stubs.StubIndexImpl.get(StubIndexImpl.java:227)