비밀번호 압축가능하게 해준다.


링크: http://www.ne.jp/asahi/hishidama/home/tech/soft/java/zip.html

posted by 뚱2

링크: http://theopentutorials.com/post/uncategorized/jaxb-marshalling-and-unmarshalling-cdata-block/

posted by 뚱2

[Java] Java HotSpot VM Options

Java/Java 2015. 10. 10. 14:45

링크: http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html

posted by 뚱2

[Java] Cron Maker

Java/Java 2015. 8. 28. 17:12

링크: http://www.cronmaker.com/

posted by 뚱2

링크: http://hannesdorfmann.com/annotation-processing/annotationprocessing101/

링크: https://deors.wordpress.com/2011/10/08/annotation-processors/

posted by 뚱2

링크: http://beyondj2ee.tumblr.com/post/14509278613/sql-log4jdbc-log4sql

posted by 뚱2

링크: http://kwonnam.pe.kr/wiki/java/jce

posted by 뚱2

링크: http://www.oracle.com/technetwork/articles/java/jf14-nashorn-2126515.html

posted by 뚱2

링크: http://lesstif.com/pages/viewpage.action?pageId=12451848

posted by 뚱2

링크: http://www.slipp.net/questions/276

posted by 뚱2

링크: http://www-01.ibm.com/support/knowledgecenter/?lang=ko#!/SSQ2R2_9.1.0/org.eclipse.jdt.doc.user/tasks/task-suppress_warnings.htm?cp=SSQ2R2_9.1.0%2F24-6-3-8-2

posted by 뚱2

[Java] CronMaker

Java/Java 2015. 3. 14. 18:02

링크: http://www.cronmaker.com/


크론 표현식을 만드는게 귀찮다면 여기를 이용하자.

posted by 뚱2

[Java] Htmlunit

Java/Java 2015. 3. 14. 15:43

링크: http://htmlunit.sourceforge.net/gettingStarted.html


자바코드단에서 Web을 테스트 해볼수 있다.

'Java > Java' 카테고리의 다른 글

[Java] SuppressWarnings의 종류.  (0) 2015.04.08
[Java] CronMaker  (0) 2015.03.14
[Java] Soap 서비스  (0) 2015.03.14
[Java] RSA 기반 웹페이지 암호화 로그인  (0) 2015.03.11
[Java] tattletale (프로젝트 구성을 볼수 있음)  (0) 2015.03.08
posted by 뚱2

[Java] Soap 서비스

Java/Java 2015. 3. 14. 12:35

툴 SoapUI: http://www.soapui.org

Apache CXF : http://cxf.apache.org


Soap client example: http://docs.oracle.com/javaee/5/tutorial/doc/bnbis.html


우선 여기까지.

'Java > Java' 카테고리의 다른 글

[Java] CronMaker  (0) 2015.03.14
[Java] Htmlunit  (0) 2015.03.14
[Java] RSA 기반 웹페이지 암호화 로그인  (0) 2015.03.11
[Java] tattletale (프로젝트 구성을 볼수 있음)  (0) 2015.03.08
[Java] 자바 매크로  (0) 2015.01.20
posted by 뚱2

링크: http://egloos.zum.com/kwon37xi/v/4427199

'Java > Java' 카테고리의 다른 글

[Java] Htmlunit  (0) 2015.03.14
[Java] Soap 서비스  (0) 2015.03.14
[Java] tattletale (프로젝트 구성을 볼수 있음)  (0) 2015.03.08
[Java] 자바 매크로  (0) 2015.01.20
[Java] HikariCP Connection Pool  (0) 2014.10.12
posted by 뚱2

링크: http://tattletale.jboss.org

'Java > Java' 카테고리의 다른 글

[Java] Soap 서비스  (0) 2015.03.14
[Java] RSA 기반 웹페이지 암호화 로그인  (0) 2015.03.11
[Java] 자바 매크로  (0) 2015.01.20
[Java] HikariCP Connection Pool  (0) 2014.10.12
[Java] Java Installer IzPack  (0) 2014.06.24
posted by 뚱2

[Java] 자바 매크로

Java/Java 2015. 1. 20. 14:16

링크: https://www.okjsp.net/seq/270141


나름 요긴하게 쓰일것 같다.

posted by 뚱2

[Java] HikariCP Connection Pool

Java/Java 2014. 10. 12. 00:46

링크: https://github.com/brettwooldridge/HikariCP

링크: https://github.com/brettwooldridge/HikariCP/wiki/Hibernate4

링크: https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration

링크: https://github.com/brettwooldridge/HikariCP/wiki/Spring-Hibernate


국내 링크: http://netframework.tistory.com/431


성능이 좋다는 말이 있다. 우선 테스트로 사용해 보고 판단하자.


Springframework datasource (context-datasource.xml)

<!-- HikariCP configuration -->

<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="shutdown">

    <constructor-arg>

        <bean class="com.zaxxer.hikari.HikariConfig">

            <constructor-arg>

                <props>

                    <prop key="dataSource.url">jdbc:mysql://localhost/database</prop>

                    <prop key="dataSource.user">username</prop>

                    <prop key="dataSource.password">password</prop>

                    <prop key="dataSource.cachePrepStmts">true</prop>

                    <prop key="dataSource.prepStmtCacheSize">250</prop>

                    <prop key="dataSource.prepStmtCacheSqlLimit">2048</prop>

                    <prop key="dataSource.useServerPrepStmts">true</prop>

                </props>

            </constructor-arg>

            <property name="dataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" />

            <property name="minimumIdle" value="5" />

            <property name="maximumPoolSize" value="10" />

            <property name="connectionTestQuery" value="SELECT 1" />

            <property name="connectionTimeout"  value="300000" />

        </bean>

    </constructor-arg>

</bean>



Tomcat + Jndi (context.xml)

<Resource name="jdbc/myJndiName"

          auth="Container"

          factory="com.zaxxer.hikari.HikariJNDIFactory"

          type="javax.sql.DataSource"

          dataSourceClassName="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"

          minimumIdle="5"

          maximumPoolSize="10"

          connectionTimeout="300000"

          connectionTestQuery="SELECT 1"


          dataSource.url="jdbc:mysql://localhost/database"

          dataSource.user="username"

          dataSource.password="password"

          dataSource.cachePrepStmts="true"

          dataSource.prepStmtCacheSize="250"

          dataSource.prepStmtCacheSqlLimit="2048"

          dataSource.useServerPrepStmts="true"

          />


'Java > Java' 카테고리의 다른 글

[Java] tattletale (프로젝트 구성을 볼수 있음)  (0) 2015.03.08
[Java] 자바 매크로  (0) 2015.01.20
[Java] Java Installer IzPack  (0) 2014.06.24
[Java] Current Project classpath  (0) 2014.05.31
[Java] Cron 문법  (0) 2014.03.31
posted by 뚱2

[Java] Java Installer IzPack

Java/Java 2014. 6. 24. 17:53

링크: http://izpack.org/

'Java > Java' 카테고리의 다른 글

[Java] 자바 매크로  (0) 2015.01.20
[Java] HikariCP Connection Pool  (0) 2014.10.12
[Java] Current Project classpath  (0) 2014.05.31
[Java] Cron 문법  (0) 2014.03.31
[Java] Open Source Installers Generators in Java  (0) 2014.01.07
posted by 뚱2

[Java] Current Project classpath

Java/Java 2014. 5. 31. 21:37

링크: http://www.mkyong.com/java/how-to-print-out-the-current-project-classpath/

'Java > Java' 카테고리의 다른 글

[Java] HikariCP Connection Pool  (0) 2014.10.12
[Java] Java Installer IzPack  (0) 2014.06.24
[Java] Cron 문법  (0) 2014.03.31
[Java] Open Source Installers Generators in Java  (0) 2014.01.07
[Java] enum에 대해서  (0) 2013.12.24
posted by 뚱2

[Java] Cron 문법

Java/Java 2014. 3. 31. 16:24

링크: http://blog.naver.com/aau21?Redirect=Log&logNo=130057861117


'Java > Java' 카테고리의 다른 글

[Java] Java Installer IzPack  (0) 2014.06.24
[Java] Current Project classpath  (0) 2014.05.31
[Java] Open Source Installers Generators in Java  (0) 2014.01.07
[Java] enum에 대해서  (0) 2013.12.24
[Java] Java Garbage Collection  (0) 2013.11.28
posted by 뚱2

링크 : http://java-source.net/open-source/installer-generators

'Java > Java' 카테고리의 다른 글

[Java] Current Project classpath  (0) 2014.05.31
[Java] Cron 문법  (0) 2014.03.31
[Java] enum에 대해서  (0) 2013.12.24
[Java] Java Garbage Collection  (0) 2013.11.28
[Java] ThreadLocal  (0) 2013.08.21
posted by 뚱2

[Java] enum에 대해서

Java/Java 2013. 12. 24. 14:26

링크 : http://bluepoet.me/2012/07/18/%EB%B2%88%EC%97%AD%EC%9E%90%EB%B0%94-enum%EC%9D%98-10%EA%B0%80%EC%A7%80-%EC%98%88%EC%A0%9C/

링크 : http://iilii.egloos.com/4343065/

'Java > Java' 카테고리의 다른 글

[Java] Cron 문법  (0) 2014.03.31
[Java] Open Source Installers Generators in Java  (0) 2014.01.07
[Java] Java Garbage Collection  (0) 2013.11.28
[Java] ThreadLocal  (0) 2013.08.21
[Java] JDBC SQL Server 연결 URL  (0) 2013.07.18
posted by 뚱2

[Java] Java Garbage Collection

Java/Java 2013. 11. 28. 12:18

링크 : http://helloworld.naver.com/helloworld/1329

'Java > Java' 카테고리의 다른 글

[Java] Open Source Installers Generators in Java  (0) 2014.01.07
[Java] enum에 대해서  (0) 2013.12.24
[Java] ThreadLocal  (0) 2013.08.21
[Java] JDBC SQL Server 연결 URL  (0) 2013.07.18
[Java] 윈도우 JDK 버전 확인  (0) 2013.05.10
posted by 뚱2

[Java] ThreadLocal

Java/Java 2013. 8. 21. 11:29

링크 : http://javacan.tistory.com/entry/ThreadLocalUsage

 

'Java > Java' 카테고리의 다른 글

[Java] enum에 대해서  (0) 2013.12.24
[Java] Java Garbage Collection  (0) 2013.11.28
[Java] JDBC SQL Server 연결 URL  (0) 2013.07.18
[Java] 윈도우 JDK 버전 확인  (0) 2013.05.10
[Java] jar 파일 실행 시키기  (0) 2013.04.07
posted by 뚱2

[Java] JDBC SQL Server 연결 URL

Java/Java 2013. 7. 18. 10:19

링크 : http://msdn.microsoft.com/ko-kr/library/ms378428(v=sql.90).aspx 

 

 

'Java > Java' 카테고리의 다른 글

[Java] Java Garbage Collection  (0) 2013.11.28
[Java] ThreadLocal  (0) 2013.08.21
[Java] 윈도우 JDK 버전 확인  (0) 2013.05.10
[Java] jar 파일 실행 시키기  (0) 2013.04.07
[Java] JDK Download  (0) 2013.04.02
posted by 뚱2

[Java] 윈도우 JDK 버전 확인

Java/Java 2013. 5. 10. 15:46

링크 : http://jmnote.com/wiki/%EC%9C%88%EB%8F%84%EC%9A%B0_JDK_%EB%B2%84%EC%A0%84_%ED%99%95%EC%9D%B8 


where /R C:\ javac.exe


'Java > Java' 카테고리의 다른 글

[Java] ThreadLocal  (0) 2013.08.21
[Java] JDBC SQL Server 연결 URL  (0) 2013.07.18
[Java] jar 파일 실행 시키기  (0) 2013.04.07
[Java] JDK Download  (0) 2013.04.02
[Java] Creating Custom Annotations and Using Them  (0) 2013.01.21
posted by 뚱2

java -classpath [jar파일] [실행할 클래스 파일명]

 

실행할 클래스 파일명은 풀 패키지 명을 입력해야 합니다.

 

예를 들어 jar 파일 구조가

com.test.Utils.class

com.test.MainWindow.class

로 구성된 jar 파일이

test.jar로 되어 있고 MainWindow.class 파일안에 main 메소드가 존재한다면

 

java -classpath test.jar com.test.MainWindow

로 실행하면 됩니다.

'Java > Java' 카테고리의 다른 글

[Java] JDBC SQL Server 연결 URL  (0) 2013.07.18
[Java] 윈도우 JDK 버전 확인  (0) 2013.05.10
[Java] JDK Download  (0) 2013.04.02
[Java] Creating Custom Annotations and Using Them  (0) 2013.01.21
[Java] Class<?> 의 의미?  (0) 2013.01.21
posted by 뚱2

[Java] JDK Download

Java/Java 2013. 4. 2. 15:04

링크       : http://www.oracle.com/technetwork/java/javase/downloads/index.html


이전버전 : http://www.oracle.com/technetwork/java/javase/archive-139210.html 

 

'Java > Java' 카테고리의 다른 글

[Java] 윈도우 JDK 버전 확인  (0) 2013.05.10
[Java] jar 파일 실행 시키기  (0) 2013.04.07
[Java] Creating Custom Annotations and Using Them  (0) 2013.01.21
[Java] Class<?> 의 의미?  (0) 2013.01.21
[Java] JConsole 연결 옵션  (0) 2013.01.05
posted by 뚱2

링크 : http://isagoksu.com/2009/development/java/creating-custom-annotations-and-making-use-of-them/ 

 

How to Create a Custom Annotations?

There are a lot of documentation about this part in the Internet. All you have to do is basically creating an annotation class like below:

public @interface Copyright {
    String info() default "";
}

And that’s it. Now it’s ready to use! Now you can put copyright information to your classes :) Since we didn’t define any @Target, you can use this annotation anywhere in your classes by default. If you want your annotation to be only available for class-wise or method-wise, you should define @Target annotation. Here is a little table of what options are available:

  • @Target(ElementType.PACKAGE), package header
  • @Target(ElementType.TYPE), class header
  • @Target(ElementType.CONSTRUCTOR), constructor header
  • @Target(ElementType.METHOD), method header
  • @Target(ElementType.FIELD), for class fields only
  • @Target(ElementType.PARAMATER), for method parameters only
  • @Target(ElementType.LOCAL_VARIABLE), for local variables only

If you want your annotation to be available in more than one place, just use array syntax as in:

@Target({ ElementType.PARAMETER, ElementType.LOCAL_VARIABLE })

One thing you may already notice is annotations are interfaces, so you don’t implement anything in them.

How to Make Use of Your Custom Annotations?

Up to here, you can find lots of examples. Okaaay, now let’s do something useful :) For instance, let’s re-implement JUnit’s @Test annotation. As you guys already know, @Test annotation is a marker annotation. Basically it marks the method as test method. If you’re expecting any exceptions, you would set expect attribute in the annotation. You can try anything here, I’m just using this example since everyone knows how @Test annotation works.

First let’s define our annotation:

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Test {
    Class expected();
}

You might notice that I used @Retention. This annotation marks our annotation to be retained by JVM at runtime. This will allow us to use Java reflections later on.

Now we need to write our annotation parser class. This class will parse our annotation and trigger some other invocations related to what we want. Keep in mind that if you have more than one custom annotation, then it’s also wise to have separate parsers for each annotation you define. So I’ll create one for this! The basic idea behind the annotation parser is using Java reflections to access the annotation information/attributes etc. So here is an example parser for our @Test annotation:

public class TestAnnotationParser {
    public void parse(Class<?> clazz) throws Exception {
        Method[] methods = clazz.getMethods();
        int pass = 0;
        int fail = 0;

    for (Method method : methods) {
        if (method.isAnnotationPresent(Test.class)) {
            try {
                method.invoke(null);
                pass++;
            } catch (Exception e) {
                fail++;
            }
        }
    }
}

}

That’s all you need. You parser is ready to use too. But wait a minute, we didn’t implement anything about the annotation attributes. This part is a bit tricky. Because you cannot directly access those attributes from the object graph. Luckily invocation helps us here. You can only access these attributes by invoking them. Sometimes you might need to cast the class to the annotation type too. I’m sure you’ll figure out when you see it:) Anyways here is a bit more logic to take our expected attribute into account:

// ...
// this is how you access to the attributes
Test test = method.getAnnotation(Test.class);
// we use Class type here because our attribute type
// is class. If it would be string, you'd use string
Class expected = test.expected();
try {
    method.invoke(null);
    pass++;
} catch (Exception e) {
    if (Exception.class != expected) {
        fail++;
    } else {
        pass++;
    }
}
// ...

Now everything is ready to use. Below example demonstrates how you use Parser with your test classes:

public class Demo {
    public static void main(String [] args) {
        TestAnnotationParser parser = new TestAnnotationParser();
        parser.parse(MyTest.class);
        // you can use also Class.forName 
        // to load from file system directly!
    }
}

Yeah, I hope you enjoyed. Don’t hesitate to put some comments down if you’ve a better approach? Thanks! Here is the full parser class implementation:

public class TestAnnotationParser {
    public void parse(Class<?> clazz) throws Exception {
        Method[] methods = clazz.getMethods();
        int pass = 0;
        int fail = 0;

    for (Method method : methods) {
        if (method.isAnnotationPresent(Test.class)) {
            // this is how you access to the attributes
            Test test = method.getAnnotation(Test.class);
            Class expected = test.expected();
            try {
                method.invoke(null);
                pass++;
            } catch (Exception e) {
                if (Exception.class != expected) {
                    fail++;
                } else {
                    pass++;
                }
            }
        }
    }
}

}

Edit: Also after receiving some emails, I guess I should add a full working example :) So here is one. Just copy paste and run the show :)

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@interface Test {
    String info() default "";
}

class Annotated { @Test(info = "AWESOME") public void foo(String myParam) { System.out.println("This is " + myParam); } }

class TestAnnotationParser { public void parse(Class clazz) throws Exception { Method[] methods = clazz.getMethods();

    for (Method method : methods) {
        if (method.isAnnotationPresent(Test.class)) {
            Test test = method.getAnnotation(Test.class);
            String info = test.info();

            if ("AWESOME".equals(info)) {
                 System.out.println("info is awesome!");
                 // try to invoke the method with param
                 method.invoke(
                    Annotated.class.newInstance(), 
                    info
                 );
            }
        }
    }
}

}

public class Demo { public static void main(String[] args) throws Exception { TestAnnotationParser parser = new TestAnnotationParser(); parser.parse(Annotated.class); } }

'Java > Java' 카테고리의 다른 글

[Java] jar 파일 실행 시키기  (0) 2013.04.07
[Java] JDK Download  (0) 2013.04.02
[Java] Class<?> 의 의미?  (0) 2013.01.21
[Java] JConsole 연결 옵션  (0) 2013.01.05
[Java] Java 모니터링 툴 VisualVM Download  (0) 2012.12.28
posted by 뚱2