Skip to content

Instantly share code, notes, and snippets.

View darbyluv2code's full-sized avatar

Chad Darby darbyluv2code

View GitHub Profile
@darbyluv2code
darbyluv2code / output.txt
Created March 28, 2020 14:14
mvn clean compile
chaddarby bonus-code-spring-security-user-registration-custom-user-details $ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-security-custom-user-registration-demo 1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact org.hibernate:hibernate-validator:jar:6.0.7.Final has been relocated to org.hibernate.validator:hibernate-validator:jar:6.0.7.Final
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-core/5.0.4.RELEASE/spring-security-core-5.0.4.RELEASE.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/security/spring-security-core/5.0.4.RELEASE/spring-security-core-5.0.4.RELEASE.jar (422 kB at 677 kB/s)
[INFO]
@darbyluv2code
darbyluv2code / pom.xml
Created February 13, 2020 06:01
Maven pom for Spring Core
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.demo</groupId>
<artifactId>spring-simple-demo</artifactId>
<version>1.0.0</version>
<properties>
@darbyluv2code
darbyluv2code / pom.xml
Created February 13, 2020 06:00
Maven pom for Spring MVC
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.luv2code.springdemo</groupId>
<artifactId>spring-mvc-demo-maven-xml-config</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<properties>
<springframework.version>5.2.3.RELEASE</springframework.version>
@darbyluv2code
darbyluv2code / sql
Created February 7, 2020 10:06
other sql commands
Question: What do the special MySQL commands means?
Answer:
Hi,
Good question!
Those lines of code are for setting MySQL server system configuration variables. In tells MySQL what configurations to use when you are running the scripts.
@darbyluv2code
darbyluv2code / StudentDbUtil.java
Last active January 18, 2020 17:42
StudentDbUtil.java
package com.luv2code.web.jdbc;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@darbyluv2code
darbyluv2code / pom.xml
Created January 7, 2020 00:45
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
@darbyluv2code
darbyluv2code / ApplicationConfig.java
Created October 11, 2019 19:52
Spring @EnableTransactionManagement
package spring.demo.rest.config;
import java.beans.PropertyVetoException;
import java.util.Properties;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@darbyluv2code
darbyluv2code / StudentDbUtil.java
Created September 27, 2019 03:20
student db util
package com.luv2code.web.jdbc;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
@darbyluv2code
darbyluv2code / StudentController.java
Created August 31, 2019 13:54
Spring MVC Form Validation - with custom model attributes
@RequestMapping("/processForm")
public String processForm(@Valid @ModelAttribute("student") Student theStudent, BindingResult result, Model model) {
if(result.hasErrors()) {
// add the country options to the model
model.addAttribute("theCountryOptions", countryOptions);
// add the favorite Language options to the model
model.addAttribute("favoriteLanguageOptions", favoriteLanguageOptions);
// add the favorite Os options to the model
@darbyluv2code
darbyluv2code / list_students.jsp
Created August 27, 2019 02:13
list_students.jsp
<%@page import="com.dj.bean.Student"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*,com.dj.*"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>