Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

José Vieira Neto NetoDevel

🏠
Working from home
View GitHub Profile
View junit2
package br.com.sed.seris.scenarios;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import br.com.sed.seris.domain.ContaminationScenario;
import br.com.sed.seris.domain.ContaminationSource;
import br.com.sed.seris.domain.ExpositionRoute;
View example servlet
public class OiMundo extends HttpServlet {
protected void service (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
// escreve o texto
out.println("<html>");
out.println("<body>");
out.println("Primeira servlet");
View example web.xml
<servlet>
<servlet-name>primeiraServlet</servlet-name>
<servlet-class>br.com.caelum.servlet.OiMundo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>primeiraServlet</servlet-name>
<url-pattern>/oi</url-pattern>
</servlet-mapping>
View install nginx ubuntu
sudo apt-get update
sudo apt-get install nginx
View install java 8 ubuntu
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
View build maven and execute spring boot
mvn clean package
nohup java -jar SEU-JAR-SNAPSHOT.jar --server.port=8081 &
View .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# We use preexec and precmd hook functions for Bash
# If you have anything that's using the Debug Trap or PROMPT_COMMAND
# change it to use preexec or precmd
# See also https://github.com/rcaloras/bash-preexec
# If not running interactively, don't do anything
case $- in
View api ror
class Api::V1::UserController < ApplicationController
def index
@api_v1_users = User.all
render json: @api_v1_users
end
end
###
View webconfig
package com.baeldung.spring.security.x509;
import java.security.Principal;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
View dependency test
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>