This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Document | |
@Getter | |
@Setter | |
public class Album extends ValueObjectBase { | |
@Id | |
private ObjectId id; | |
private String title; | |
private String artist; | |
private List<Track> tracks = new ArrayList<Track>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Spring framework --> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-core</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-context</artifactId> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@SuppressWarnings("unchecked") | |
public void configurationTest() throws InterruptedException { | |
ConfigurationBuilder builder = new ConfigurationBuilder(); | |
builder.loaders().addStore(MongoDBCacheStoreConfigurationBuilder.class) | |
.host("localhost") | |
.port(27017) | |
.timeout(2000) | |
.acknowledgment(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Infinispan --> | |
<dependency> | |
<groupId>org.infinispan</groupId> | |
<artifactId>infinispan-core</artifactId> | |
<version>${infinispan.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.infinispan</groupId> | |
<artifactId>infinispan-spring</artifactId> | |
<version>${infinispan.version}</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Infinispan --> | |
<dependency> | |
<groupId>org.infinispan</groupId> | |
<artifactId>infinispan-core</artifactId> | |
<version>${infinispan.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.infinispan</groupId> | |
<artifactId>infinispan-spring</artifactId> | |
<version>${infinispan.version}</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collection.{mutable, JavaConversions} | |
/** | |
* Java 자료구조 (Iterable, Iterator, List, Set, Map)와 Scala 자료구조 (Iterable, Iterator, List, Set, Map) 를 | |
* 암묵적(implicit)하게 변환해줍니다. | |
* 사용 시 import kr.hconnect.core.collections.Java2Scala._ 를 해주시면 됩니다. | |
* | |
* @author 배성혁 [email protected] | |
* @since 13. 6. 27. 오후 1:43 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MySQL Replication 환경 (Master-Slave)에서 | |
* {@link org.springframework.transaction.annotation.Transactional#readOnly()} 이 true로 정의된 Method에 대해서는 | |
* Slave 서버로 접속하기 위해, {@link java.sql.Connection#isReadOnly()}의 속성을 true로 변경하여 작업을 수행하도록 합니다. | |
* | |
* @author 배성혁 [email protected] | |
* @since 13. 7. 5. 오후 11:07 | |
*/ | |
@Aspect | |
@Component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Target( { ElementType.METHOD } ) | |
@Retention( RetentionPolicy.RUNTIME ) | |
@Inherited | |
public @interface ReadOnlyConnection { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Slf4j | |
@Service | |
@SuppressWarnings("unchecked") | |
public class SimpleEntityServiceImpl implements SimpleEntityService { | |
@Autowired SessionFactory sessionFactory; | |
@Transactional( readOnly = true ) | |
@ReadOnlyConnection | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Aspect | |
@Component | |
public class ConnectionInterceptor { | |
private static final Logger log = LoggerFactory.getLogger(ConnectionInterceptor.class); | |
private static final boolean isTraceEnabled = log.isTraceEnabled(); | |
@Autowired | |
private SessionFactory sessionFactory; |