Quarkus Bookmarks

Published: 2020-05-05, Updated: 2020-08-11

Links

mvn io.quarkus:quarkus-maven-plugin:1.4.1.Final:create \
  -DprojectGroupId=my-groupId \
  -DprojectArtifactId=my-artifactId \
  -DprojectVersion=my-version \
  -DclassName="org.my.group.MyResource" \
  -Dextensions="resteasy-jsonb" \
  -DbuildTool=gradle

Eager initialization do Bean

Option 1

@Singletion
public class SomeBean {
  void onStart(@Observes StartupEvent ev) { 
  }
}

Option 2

@Startup
@Singletion
public class SomeBean {
  @PostConstruct
  void onStart() { 
  }
}

Padrão de logs

quarkus.log.level=INFO
quarkus.log.category."io.agroal".level=TRACE
quarkus.log.category."org.apache.http.client.protocol.ResponseProcessCookies".level=ERROR
quarkus.log.console.format=%d{HH:mm:ss.SSS} [%15.-15t] %-3.3p %i %0.-35C m=%M:%L %m%n
%prod.quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss.SSS} [%15.-15t] %-3.3p %i %0.-35C m=%M:%L %m%n

Gerar artefato no próprio site

Info sobre postagem/consumo kafka

Profiles

Comportamento dos profiles

Para forçar um profile

Variável de ambiente QUARKUS_PROFILE ou system property quarkus.profile

Testando e fazendo mocks de beans

Mocando um Bean (Forma 1)

@Inject
SteamAPI steamAPI;

@BeforeAll
static void beforeAll(){
  final var mock = mock(SteamAPI.class);
  doReturn("").when(mock).someCall(); // os mocks tem que ser feitos aqui nessa abordagem
  QuarkusMock.installMockForType(, SteamAPI.class);
}
@InjectMock
SteamAPI steamAPI;


@Test
void test(){
  doReturn("").when(mock).someCall(); 
  ....
}

quarkus commands, quarkus examples


Isolamento Acústico de Parede / Orçamento Speed Run Resident Evil 4

Comments