String이란
String의 문자열은 아래와 같이 value에 저장된다. (Java 버전에 따라 방식이 달라짐)// Java9 이전private final char[] value;// Java9 이후private final byte[] value;※ 자바에서 문자를 표현할때는 2byte를 사용. 영어 및 숫자는 1byte로 표현이 가능그래서 영어, 숫자로만 이뤄져있을시 1byte를 사용하고 그렇지않으면 2byte로 사용하기로 되어 효율적으로 변경 String은 참조형타입이다.문자열 비교를 할때는 ==가 아닌 equals() 메서드를 사용하여야 한다.String str1 = new String("hello");String str2 = new String("hello");System.out.println("new Stri..
2024.05.29
no image
이클립스 tomcat server 실행시 에러
프로젝트 server를 실행하는 과정에서 아래와 같이 별 에러가 다 발생 * Context initialization failed * Exception encountered during context initialization - cancelling refresh attempt * Injection of resource dependencies failed 같은 svn에서 내려받아서 check out하고 한거라 소스상에는 문제가 업다고 판단했고, 내 pc셋팅문제라고 생각이 들었다. 설정된것들을 보니 jdk문제였다. 프로젝트는 jdk1.8인데 톰캣을 실행하면 jdk17로 잡혀서 프로젝트가 실행이 안되고 에러가 발생 그래서 이클립스 상에서 jdk를 바꾸려고 알아봤다. 이클립스 > window > Prefere..
2024.02.15
[SpringBoot] Mapper 설정
src/main/java에 domain구조로 프로젝트를 설정하여, controller/service/mapper로 패키지를 구성하였으며, src/main/resources에 mapper 패키지에 xml을 생성하였다. mapper와 mapper/xml을 연결하는 설정은 아래와 같다. application.properties # mybatis settings mybatis.mapper-locations:mapper/**/*.xml
2024.02.08
Circular view path [getTest]: would dispatch back to the current handler URL [/getTest] again. Check your ViewResolver setup!
controller에서 viewResolver에 대한 셋팅을 안해서 생긴 이슈
2023.06.03
[SpringBoot] java.lang.Long cannot be cast to java.lang.Integer
db에서 가져온 데이터를 Integer로 캐스팅 하던중 오류 발 Integer.parseInt(String.valueOf( ~~ )); 해주니 해결
2023.02.11
[Spring Boot] log4j DB로그 확인
console을 통해서 db작업 확인을 하기 위해 추가하였다. 1. build.gradle // sql log implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16' 2. application.properties //application.properties spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy spring.datasource.url = jdbc:log4jdbc:mysql:~~~ 3. resources에 파일 두개 추가 //log4jdbc.log4j2.properties log4jdbc.spylogdelegator.name=net.sf.log4j..
2023.02.11
[SpringBoot] Spring Security
암호화 작업을 하기 위하여 스프링 시큐리티를 사용하였다. 1. build.gradle에 추가 //build.gradle //spring security implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' 2. util @EnableWebSecurity @AllArgsConstructor @Configuration public class SpringSecurity{ /** * 패스워드 암호화 * */ @Bean public PasswordEncoder getPasswordEncoder() { return n..
2023.02.11
[JAVA] 객체지향 프로그래밍
오버로딩 / 오버라이딩 오버로딩은 기존에 없는 새로운 메서드를 추가 오버라이딩은 조상으로부터 상속받은 메서드의 내용을 변경 super 자손 클래스에서 조상 클래스로부터 상속받은 멤버를 참조할때 사용 public class SuperTest { public static void main(String[] args) { Child c = new Child(); c.method(); } } class Parent{ int x = 10; } class Child extends Parent{ int x = 20; void method(){ System.out.println("x=" + x); // 20 System.out.println("this.x=" + this.x); // 20 System.out.printl..
2023.02.07