Latest Added Tutorials
You need to provide your own Binding methods and then create the correct subtypes. Spring wouldn't know otherwise which of the subtypes should be instantiated for which element.
Example: Url address can be like this: /proje-basvuru/ilk-uzun-metrajli-film or /proje-basvuru/kisa-film
@ModelAttribute("project")
public Project getProject(final HttpServletRequest request){
return createProject(getProjeBasvuruUrl(request.getRequestURI()));
}
private Project createProject(String projectType) {
if (projectType.equals("ilk-uzun-metrajli-film"))
r...Continue Reading
08-02-2016
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/applicationContext.xml", "classpath:/mvc-dispatcher-servlet.xml",
"classpath:/spring-security.xml"})
@WebAppConfiguration
public class GumrukServiceUtilTest {
@Autowired
WebApplicationContext wac;
@Autowired
private UserService userService;
private MockMvc mockMvc;
@Before
public void setup(){
MockitoAnnotations.initMocks(this);
this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();...Continue Reading
Maven Dependencies
<properties>
<spring.test>4.1.4.RELEASE</spring.test>
<junit.version>4.12</junit.version>
<hamcrest.version>1.3</hamcrest.version>
<mockito.all>2.0.2-beta</mockito.all>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.test}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactI...Continue Reading
Create Password
After downloaded Jasypt CLI Tools, execute following code by using encrypt.sh for linux based OS, or encrypt.bat file for Windows located in bin folder:
encrypt.bat input="secret" password=encryptorpassword algorithm=PBEWithMD5AndTripleDES
Output looks like this: AdK2HjMDfxTABg9ZP3kXSWsKo3t4rSn7
Note: Whenever run above command in command prompt, you will get different password each time because PBEWithMD5AndTripleDES algorithm and many other algorithms use random salt generator. For more information please click
Add Maven Depe...Continue Reading
Internationalization (i18n) or localization (L10n) is used to change language of a web application for better interaction. In this article, I will try to configure Spring MVC web application to use the Internationalization concept.
Spring MVC Configuration Steps
1. mvc-dispatcher-servlet.xml file
<mvc:interceptors>
<!-- Changes the locale when a 'lang' request parameter is sent; e.g. /?lang=tr -->
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="para...Continue Reading
05-06-2015
In Spring MVC if you have two separate xml files which are applicationContext.xml and mvc-dispatcher-servlet.xml, then you must set use-default-filters attribute value to false to disable automatic detection opf classes annotated with @Component, @Repository, @Service or @Controller as follows:
applicationContext.xml file
<context:component-scan base-package="com.codesenior.telif.web">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
mvc-dispatcher-s...Continue Reading
<!-- enable use-expressions -->
<http auto-config="true" use-expressions="true">
<!-- src** matches: src/bar.c src/baz.c src/test/bartest.c-->
<intercept-url pattern="/problemSolution/home/**" access="hasRole('ROLE_ADMIN')"/>
<intercept-url pattern="favicon.ico" access="permitAll"/>
<form-login
authentication-success-handler-ref="authenticationSuccessHandler"...Continue Reading
30-12-2014
A Swing Architecture Overview
The Inside Story on JFC Component Design (Yazar Amy Fowler)
Most Swing developers know by now that Swing components have a separable model-and-view design. And many Swing users have run across articles saying that Swing is based on something called a "modified MVC (model-view-controller) architecture."
But accurate explanations of how Swing components are designed, and how their parts all fit together, have been hard to come by -- until ...