<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Poojitha</title>
    <description>The latest articles on DEV Community by Poojitha (@poojithalakkaraju).</description>
    <link>https://dev.to/poojithalakkaraju</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3937692%2F382506ad-338a-4c28-85d8-f1841871f01d.png</url>
      <title>DEV Community: Poojitha</title>
      <link>https://dev.to/poojithalakkaraju</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/poojithalakkaraju"/>
    <language>en</language>
    <item>
      <title>Spring boot Interview Questions</title>
      <dc:creator>Poojitha</dc:creator>
      <pubDate>Fri, 22 May 2026 18:18:21 +0000</pubDate>
      <link>https://dev.to/poojithalakkaraju/spring-boot-interview-questions-1eol</link>
      <guid>https://dev.to/poojithalakkaraju/spring-boot-interview-questions-1eol</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. What is CORS and why is it required?&lt;/strong&gt;&lt;br&gt;
CORS (Cross-Origin Resource Sharing) is a browser security mechanism that allows/restricts APIs from being accessed by another domain.&lt;br&gt;
Example:&lt;br&gt;
Frontend: &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;br&gt;
Backend API: &lt;a href="http://localhost:8080" rel="noopener noreferrer"&gt;http://localhost:8080&lt;/a&gt;&lt;br&gt;
These are different origins because ports are different.&lt;br&gt;
Without CORS configuration, browser blocks the request.&lt;br&gt;
Why required?&lt;br&gt;
To securely allow frontend applications to call backend APIs hosted on different domains/ports.&lt;br&gt;
Interview Answer:&lt;br&gt;
CORS is a browser security feature that controls cross-origin HTTP requests. It is required when frontend and backend run on different domains, ports, or protocols. In Spring Boot, we configure CORS to allow trusted origins to access APIs securely.&lt;br&gt;
&lt;strong&gt;2. How do you configure CORS in Spring Boot?&lt;/strong&gt;&lt;br&gt;
Using @CrossOrigin&lt;br&gt;
Java&lt;br&gt;
@RestController&lt;br&gt;
@CrossOrigin(origins = "&lt;a href="http://localhost:3000%22" rel="noopener noreferrer"&gt;http://localhost:3000"&lt;/a&gt;)&lt;br&gt;
public class UserController {&lt;br&gt;
}&lt;br&gt;
Global Configuration&lt;br&gt;
Java&lt;br&gt;
@Configuration&lt;br&gt;
public class CorsConfig {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurer() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedOrigins("http://localhost:3000")           .allowedMethods("GET", "POST", "PUT", "DELETE");
        }
    };
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;br&gt;
Real-time usage:&lt;br&gt;
In production, React/Angular frontend calls Spring Boot APIs from another domain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. What is CSRF attack?&lt;/strong&gt;&lt;br&gt;
CSRF = Cross Site Request Forgery&lt;br&gt;
It tricks a logged-in user into performing unwanted actions.&lt;br&gt;
Example:&lt;br&gt;
User logged into banking site&lt;br&gt;
Malicious website sends transfer request automatically&lt;br&gt;
Browser sends session cookie&lt;br&gt;
Server thinks request is genuine&lt;br&gt;
Interview Answer:&lt;br&gt;
CSRF attack occurs when a malicious site tricks an authenticated user into sending unauthorized requests to another application where the user is already logged in.&lt;/p&gt;

</description>
      <category>career</category>
      <category>interview</category>
      <category>java</category>
      <category>springboot</category>
    </item>
    <item>
      <title>application.properties</title>
      <dc:creator>Poojitha</dc:creator>
      <pubDate>Fri, 22 May 2026 11:11:17 +0000</pubDate>
      <link>https://dev.to/poojithalakkaraju/applicationproperties-2f97</link>
      <guid>https://dev.to/poojithalakkaraju/applicationproperties-2f97</guid>
      <description>&lt;p&gt;&lt;strong&gt;1.spring.datasource.hikari.connectionTimeout&lt;/strong&gt;&lt;br&gt;
Meaning:&lt;br&gt;
How long an application waits to get a DB connection from the pool before throwing an exception.&lt;br&gt;
Ex:&lt;br&gt;
spring.datasource.hikari.connectionTimeout=30000&lt;br&gt;
= Wait for 30 seconds&lt;br&gt;
Real-time Scenario&lt;br&gt;
Suppose:&lt;br&gt;
All DB connections are busy&lt;br&gt;
New request comes&lt;br&gt;
Application asks pool for connection&lt;br&gt;
If no connection becomes available within 30 seconds:&lt;br&gt;
Plain text&lt;br&gt;
SQLTransientConnectionException:&lt;br&gt;
Connection is not available, request timed out&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;2.spring.datasource.hikari.idleTimeout&lt;/strong&gt;&lt;br&gt;
Meaning:&lt;br&gt;
How long an unused/idle connection stays in pool before being removed.&lt;br&gt;
Unit&lt;br&gt;
Milliseconds&lt;br&gt;
Example&lt;br&gt;
Properties&lt;br&gt;
spring.datasource.hikari.idleTimeout=600000&lt;br&gt;
= 10 minutes&lt;br&gt;
Real-time Understanding&lt;br&gt;
Suppose:&lt;br&gt;
Your app created 20 DB connections&lt;br&gt;
Only 5 are being used&lt;br&gt;
Remaining 15 are idle&lt;br&gt;
After idleTimeout duration:&lt;br&gt;
Extra unused connections may be closed&lt;br&gt;
Helps save DB resources&lt;br&gt;
Important Point&lt;br&gt;
This works mainly when:&lt;br&gt;
Plain text&lt;br&gt;
minimumIdle &amp;lt; maximumPoolSize&lt;br&gt;
Otherwise pool keeps all connections alive.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;3.spring.datasource.hikari.maximumPoolSize&lt;/strong&gt;&lt;br&gt;
Meaning&lt;br&gt;
Maximum number of DB connections allowed in pool.&lt;br&gt;
Example&lt;br&gt;
Properties&lt;br&gt;
spring.datasource.hikari.maximumPoolSize=20&lt;br&gt;
Maximum 20 DB connections can exist.&lt;br&gt;
Real-time Scenario&lt;br&gt;
Suppose:&lt;br&gt;
20 requests are using DB connections&lt;br&gt;
21st request comes&lt;br&gt;
Then:&lt;br&gt;
It waits for available connection&lt;br&gt;
Until connectionTimeout occurs&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4.spring.datasource.hikari.minimumIdle&lt;/strong&gt;&lt;br&gt;
Meaning&lt;br&gt;
Minimum number of idle connections always maintained in pool.&lt;br&gt;
Example&lt;br&gt;
Properties&lt;br&gt;
spring.datasource.hikari.minimumIdle=5&lt;br&gt;
Even if connections are unused:&lt;br&gt;
Hikari keeps at least 5 ready connections&lt;br&gt;
Real-time Benefit&lt;br&gt;
When traffic suddenly increases:&lt;br&gt;
App gets DB connections immediately&lt;br&gt;
No delay creating new connection&lt;/p&gt;

</description>
      <category>database</category>
      <category>java</category>
      <category>springboot</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
