get( 'Version' ) );} );/** Preload the homepage LCP image without disabling lazy loading elsewhere. */add_action( 'wp_head', function () { if ( ! is_front_page() || is_paged() ) { return; } $posts = get_posts( array( 'numberposts' => 1, 'post_status' => 'publish', 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', ) ); if ( empty( $posts ) ) { return; } $thumbnail_id = get_post_thumbnail_id( $posts[0]->ID ); $thumbnail_url = $thumbnail_id ? wp_get_attachment_url( $thumbnail_id ) : false; $metadata = $thumbnail_id ? wp_get_attachment_metadata( $thumbnail_id ) : array(); $size_file = ! empty( $metadata['sizes']['pixwell_370x250-2x']['file'] ) ? $metadata['sizes']['pixwell_370x250-2x']['file'] : false; $image_url = $size_file && $thumbnail_url ? trailingslashit( dirname( $thumbnail_url ) ) . $size_file : $thumbnail_url; if ( $image_url ) { printf( '' . "\n", esc_url( $image_url ) ); }}, 1 );/** Give every tag archive a concise description based on its own posts. */add_action( 'wp_head', function () { if ( ! is_tag() ) { return; } $term = get_queried_object(); if ( ! $term instanceof WP_Term ) { return; } $post_ids = get_posts( array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 2, 'fields' => 'ids', 'tag_id' => $term->term_id, 'orderby' => 'date', 'order' => 'DESC', ) ); $titles = array_values( array_filter( array_map( function ( $post_id ) { return wp_html_excerpt( wp_strip_all_tags( get_the_title( $post_id ) ), 42, '…' ); }, $post_ids ) ) ); $context = count( $titles ) > 1 ? sprintf( '“%1$s” ve “%2$s”', $titles[0], $titles[1] ) : ( ! empty( $titles ) ? sprintf( '“%s”', $titles[0] ) : 'ilgili teknik içerikler' ); $templates = array( '%1$s hakkında %2$s başlıklı yazılar ile teknik notları Burak Kutbay’ın kişisel blogunda keşfedin.', '%1$s etiketi altında %2$s ve konuyla bağlantılı rehberler bir arada.', 'Burak Kutbay’ın blogunda %1$s için %2$s başlıklı içerikler, deneyimler ve pratik bilgiler.', '%1$s konusuna dair %2$s; ilgili yazılar ve kaynaklar bu arşivde.', '%1$s ile ilgili %2$s ve diğer güncel teknoloji içeriklerine göz atın.', '%1$s arşivinde %2$s başlıklı içerikler ve konuya yönelik teknik açıklamalar yer alır.', ); $description = sprintf( $templates[ $term->term_id % count( $templates ) ], wp_strip_all_tags( $term->name ), $context ); printf( '' . "\n", esc_attr( wp_html_excerpt( wp_strip_all_tags( $description ), 155, '…' ) ) );}, 0 );/** Build a 140-160 character fallback for posts without a custom Yoast description. */add_filter( 'wpseo_metadesc', function ( $description ) { if ( ! is_singular( 'post' ) ) { return $description; } $post = get_queried_object(); $custom = $post instanceof WP_Post ? get_post_meta( $post->ID, '_yoast_wpseo_metadesc', true ) : ''; if ( $custom ) { return $description; } $source = $post instanceof WP_Post && $post->post_excerpt ? $post->post_excerpt : ( $post instanceof WP_Post ? $post->post_content : '' ); $source = wp_strip_all_tags( strip_shortcodes( $source ) ); $fallback = wp_html_excerpt( $source, 155, '…' ); return $fallback ? $fallback : 'Burak Kutbay’ın kişisel blogunda Java, Spring, yazılım geliştirme ve teknoloji üzerine güncel teknik içerikleri keşfedin.';}, 20 );/** Redirect legacy slugs to their current posts without touching content. */add_action( 'template_redirect', function () { $request_path = parse_url( $_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH ); $request_path = rawurldecode( (string) $request_path ); $legacy_unicode_path = '/cocugunuza-programlama-ogretin-' . "\u{200E}" . 'programlamacocukoyuncagi' . "\u{202C}" . '.html/'; $redirects = array( '/spring-boot-transaction-isolation-propagation-verollback.html/' => '/spring-boot-transaction-isolation-propagation-ve-rollback.html/', '/testcontainers-ile-spring-boot-amp-mongodb-test-islemleri.html/' => '/testcontainers-ile-spring-boot-mongodb-test-islemleri.html/', '/google’dan-freddie-mercurye-ozel-klibi.html/' => '/googledan-freddie-mercurye-ozel-klibi.html/', $legacy_unicode_path => '/cocugunuza-programlama-ogretin-programlamacocukoyuncagi.html/', ); if ( isset( $redirects[ $request_path ] ) ) { wp_safe_redirect( home_url( $redirects[ $request_path ] ), 301 ); exit; }}, 1 ); Spring MVC Dersleri - Spring MVC Nedir? - Burak Kutbay'ın Kişisel Blogu

Arşivler

Spring MVC Dersleri – Spring MVC Nedir?

Spring Dersleri

Spring MVC Dersleri’ne başlıyoruz.

Model View Controller yapısını kullanarak Spring Framework ile birlikte web tabanlı projeler yapmaya imkan sağlamaktadır. Spring’in bir modülü olan Spring MVC ile işlemleri kolaylaştırarak web projeleri yapabilmekteyiz.

MVC yapısı ayrı bir yazı konusu olduğu için kısa ve kabaca şöyle açıklayayım. Uygulama verileri Model katmanında, kullanıcının görüntülenmesini istediğimiz web sayfalarını View katmanında ve bunun arasındaki iş ve işlemlerin yapılacak katman ise Controller katmanıdır.

Spring MVC’nin çalışma yapısına bakalım. Spring Framework bu freamework ile biz bir web sayfası yapacağız. Bu web sayfası günün sonunda Java tarafından derlenecektir. Java tarafından derlenen her bu sayfa bir Servlet’tir. Kısacası Spring MVC ile kodladığımız proje bir Servlete dönüşmektedir. (ilgili yazı -> bknz: Servlet Nedir?)

DispatcherServlet

blank

Spring Framework’un ise kullandığı Servlet DispatcherServlet olarak nitelendirilmektedir. DispatcherServlet’i başka yazıda detaylıca inceleceğiz ancak Spring MVC’nin çalışma yapısı hakkında bize bilgi vermektedir.

Nasıl Çalışır?

Spring MVC’nin yapısı istek tabanlıdır. Kullanıcıdan gelen her istek DispatcherServlet tarafından karşılanmaktadır. Gelen istek  handleRequest sayesinde ilgili Controller’e gider sonrasında gösterilecek olan veri yani ViewResolver sayesinde gösterilmeye hazır hale gelmektedir. Bu sayede view tarafında istenilen her türlü teknolojiyi kullanmayı sağlamakta ve bize esneklik sağlamaktadır.

Yukarıda anlattığım çalışma mantığının görselleştirilmiş halini de aşağıya bırakayım.

blank