Skip to content

Instantly share code, notes, and snippets.

View jeffscottbrown's full-sized avatar

Jeff Scott Brown jeffscottbrown

View GitHub Profile
Grails Framework Individual Contributor License Agreement
By signing below, you accept and agree to the following terms and conditions for Your present and future Contributions submitted to OCI in connection with the Grails project. In return, OCI shall not use Your Contributions in a way that is contrary to the public benefit or inconsistent with the Apache License v. 2.0. Except for the license granted herein to OCI and recipients of software distributed by OCI, You reserve all right, title, and interest in and to Your Contributions.
Definitions. "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with OCI. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of suc
import io.micronaut.runtime.event.annotation.EventListener;
import io.micronaut.runtime.server.event.ServerStartupEvent;
import javax.inject.Singleton;
@Singleton
public class MyBean {
@EventListener
public void onStartup(ServerStartupEvent event) {
// logic here
import io.micronaut.context.annotation.ConfigurationProperties;
import io.micronaut.context.annotation.EachProperty;
import java.util.List;
@ConfigurationProperties("server")
public class CountryConfig {
private List<CountryProps> list;
import io.micronaut.context.annotation.ConfigurationProperties;
import io.micronaut.context.annotation.EachProperty;
import jakarta.inject.Inject;
import java.util.List;
@ConfigurationProperties("server")
public class CountryConfig {
private List<CountryProps> list;
projects $ git clone [email protected]:PacktPublishing/Building-Microservices-with-Micronaut.git
Cloning into 'Building-Microservices-with-Micronaut'...
remote: Enumerating objects: 1423, done.
remote: Counting objects: 100% (904/904), done.
remote: Compressing objects: 100% (490/490), done.
remote: Total 1423 (delta 359), reused 762 (delta 226), pack-reused 519
Receiving objects: 100% (1423/1423), 581.57 KiB | 1.88 MiB/s, done.
Resolving deltas: 100% (510/510), done.
projects $
projects $ cd Building-Microservices-with-Micronaut/Chapter11/micronaut-petclinic
// This is some code
class Widget {
int x
}
select this_.id as id1_1_1_, this_.version as version2_1_1_, this_.user_id as user_id3_1_1_, user1_.id as id1_0_0_, user1_.version as version2_0_0_, user1_.username as username3_0_0_, user1_.password as password4_0_0_, user1_.enabled as enabled5_0_0_ from user_role this_ inner join user user1_ on this_.user_id=user1_.id order by lower(user1_.username) asc
testdemo $ mn create-app --build maven demoapp
| Application created at /Users/jeffscottbrown/testdemo/demoapp
testdemo $
testdemo $ cd demoapp
demoapp $
demoapp $ cat src/test/java/demoapp/DemoappTest.java
package demoapp;
import io.micronaut.runtime.EmbeddedApplication;
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
~ $ http :8080/genres/list
HTTP/1.1 200 OK
Content-Type: application/json
connection: keep-alive
content-length: 2
date: Sat, 31 Jul 2021 12:27:43 GMT
[]
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class JavaDemo {
public static void main(String[] args) {
int[]array = {1,2,3,4,5,6,7};
int[] newArray = reorderFromIndex(array, 4);