Welcome to Sproogy
Sproogy is a lightweight, Spring-inspired framework for Java that brings the power of Inversion of Control (IoC) and Dependency Injection (DI) to the world of secure socket programming.
What is Sproogy?
Sproogy combines two powerful concepts:
-
Dependency Injection Container - Inspired by Spring Framework, Sproogy provides a robust IoC container that manages your application components and their dependencies.
-
SSL Socket Abstraction - Unlike traditional web frameworks, Sproogy specializes in secure socket communication, providing a high-level API for building TCP/SSL server-client applications.
Why Choose Sproogy?
For Spring Developers
If you're familiar with Spring, you'll feel right at home with Sproogy:
- Familiar annotations:
@Component,@Service,@Autowired,@Value - Lifecycle management: Similar bootstrap process with hooks
- Configuration system: YAML/JSON application files + environment variables
- JPA integration: Repository pattern with
@Queryand@Transactional
For Socket Programmers
Sproogy removes the boilerplate from socket programming:
- No manual SSL configuration: Just implement a security loader interface
- Automatic serialization: JSON request/response handling out of the box
- Filter chain pattern: Interceptors for authentication, logging, encryption
- Controller routing: Map methods to endpoints like REST APIs
Key Differentiators
| Feature | Traditional Sockets | Sproogy |
|---|---|---|
| Dependency Injection | Manual instantiation | Automatic with @Autowired |
| SSL Setup | 50+ lines of boilerplate | Single interface implementation |
| Request Routing | Manual string parsing | @AppMapping("/endpoint") |
| Lifecycle Management | Manual thread handling | Automatic with graceful shutdown |
| Data Access | Manual JDBC | JPA repositories with DI |
Real-World Use Cases
Sproogy excels in scenarios where you need:
- Custom Protocol Servers: Build proprietary communication protocols with SSL security
- Microservice Communication: Direct TCP/SSL communication between services (faster than HTTP)
- IoT Device Management: Manage thousands of persistent SSL connections
- Financial Systems: High-throughput, low-latency transaction processing
- Gaming Servers: Real-time multiplayer game state synchronization
Architecture Overview
Quick Peek: Hello World
Here's a complete Sproogy application in under 30 lines:
// Main.java
@SproogyApplication(basePackage = "com.example")
public class Main {
public static void main(String[] args) {
SproogyApp.run(Main.class, args);
}
}
// HelloController.java
@Controller
public class HelloController {
@AppMapping("/hello/{name}")
public ResponseEntity<String> hello(@PathVariable("name") String name) {
return ResponseEntity.ok("Hello, " + name + "!");
}
}
// SSLConfig.java
@Component
public class SSLConfig implements SSLFactoryLoader {
@Override
public SSLServerSocketFactory getSSLServerSocketFactory() throws Exception {
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(new FileInputStream("keystore.jks"), "password".toCharArray());
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(keyStore, "password".toCharArray());
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(kmf.getKeyManagers(), null, null);
return sslContext.getServerSocketFactory();
}
}
Configuration (.env):
SOCKET_PORT=8443
That's it! Run the application, and you have a secure SSL server listening on port 8443.
What You'll Learn
This documentation will guide you through:
- Getting Started - Installing Sproogy and building your first application
- Core Concepts - Understanding IoC/DI, lifecycle, and annotations
- Socket Programming - Building robust SSL servers and clients
- Data Access - Using JPA repositories with dependency injection
- Advanced Topics - Custom transformers, performance tuning, modularity
- Troubleshooting - Common issues and best practices
Prerequisites
Before diving in, you should have:
- Java 11+ installed (Sproogy is built on modern Java)
- Basic Java knowledge (classes, interfaces, annotations)
- Understanding of sockets (helpful but not required)
- Familiarity with Spring (optional, but makes learning easier)
Next Steps
Ready to build your first Sproogy application? Head over to the Installation Guide to get started!
If you get stuck, check out the Troubleshooting section or the FAQ.