MONIMEGA
  • Blog
    • Politics
    • Software
    • Technology
    • Business
    • Design
    • Hardware
    • Health
    • Italy
    • Music
    • Sports
    • Strategy
    • World
  • Contatto
  • Galleria
  • Informazioni
  • Servizi
  • First Pill for Postpartum Depression Shows Varied Real-World Results

    July 22, 2025
    Health

    Some women’s symptoms improved quickly after taking the pill, but depression persisted in others. Doctors are trying to learn which patients benefit, and why some don’t.


    Source: NYT > Well.

  • AT&T Promo Code: Get a Gift Card Worth Up to $200

    AT&T Promo Code: Get a Gift Card Worth Up to $200

    July 22, 2025
    Technology

    Whether you’re looking to upgrade your internet or get the latest phone, we’ve got you covered with our selection of AT&T coupons and deals.


    Source: Wired.

  • Cowboys' Parsons reports amid unsettled deal

    July 22, 2025
    Sports

    Cowboys’ Parsons reports amid unsettled deal

    OXNARD, Calif. — The Micah Parsons watch is on.

    The Dallas Cowboys‘ Pro Bowl pass rusher reported to training camp in Oxnard, California, on Monday, but what’s not clear is whether Parsons will take part in practice when the Cowboys begin workouts Tuesday as he awaits a long-term extension.

    Owner and general manager Jerry Jones and coach Brian Schottenheimer did not directly say Parsons would practice, leading to speculation that there could be something of a hold-in for the four-time Pro Bowler.

    The Cowboys and Parsons’ agent, David Mulugheta, have not had discussions on a contract extension. Neither Jerry Jones nor Stephen Jones, the Cowboys’ executive vice president, has spoken with Mulugheta about a deal.

    In March, Parsons and Jerry Jones met in the owner’s office at The Star in Frisco, Texas.

    Jones would not say whether he believed they were on the verge of a deal but said, “Let’s put it like this, we went over every possible detail that you can go over and had agreement.”

    In the past, Jones has had direct conversations with players that have led to contracts without the agents being involved. Parsons has asked the Cowboys to work through Mulugheta on a new deal.

    Jones said he is OK in dealing with “dangling participles.”

    “Two years ago, we were here, and I think Zack Martin wasn’t here,” Jones said. “You had a situation although he had a contract, so you worked through that. … There’s nothing new about what we’re talking about relative to contracts. That’s been going on a long time; if you say, ‘Well, if you don’t get him in, are you going to lose the first two games and go on and win the Super Bowl?’ Well, I’ll take that.”

    That was in reference to Emmitt Smith missing the first two games of the 1993 season in a contract dispute before returning and leading the Cowboys to a second Super Bowl win in a row.

    Since Jones’ conversation with Parsons, a number of high-priced pass rushers have signed, including the Pittsburgh Steelers‘ T.J. Watt, who became the highest-paid non-quarterback in the NFL with a deal that averages $41 million per season.

    Jones said he does not worry about the price going up as the wait goes on.

    “It’s just the times you’re in and the money you’re at,” the owner said. “I’m not trying to be cute, but it’s all relevant. Again, I don’t have any issue. I’m not concerned at all about what our team can be this year and develop into and what we make of our training camp. I’m not at all concerned about a contract that involves or affects that in any way. I can’t emphasize that enough.”

    Schottenheimer said if Parsons does go through with a hold-in, it would not impact the team’s work.

    “The fact that Micah is here, he’s talked all offseason about wanting more of a leadership role, he’s talked about wanting to be great,” Schottenheimer said. ‘We know he’s a great player. I think we’re excited he’s here and there’re a lots of ways to get this thing done, but we’re committed to having him take that next step, not just as a player but as a leader.”

    The State of the Cowboys news conference lasted more than 50 minutes, and while Parsons was most of the focus, there were other topics, including the $500,000 de-escalator clause in the contract of cornerback Trevon Diggs.

    Because Diggs failed to take part in 84% of the offseason program as he rehabbed his surgically repaired left knee, his 2025 base salary was docked $500,000 to $8 million. A number of high-priced players, including Dak Prescott, CeeDee Lamb and Osa Odighizuwa have the clause in their contracts. It’s a device the Cowboys have used for years, but Diggs, who will start camp on the physically unable to perform list, is believed to be the first to see a cut in pay for failing to participate.

    “It would be very detrimental to the team not to abide by the agreement,” Jones said.

    Jones said that there have been times in the past when he has contemplated giving up his general manager title as the Cowboys’ Super Bowl drought has reached 29 years but that those moments were for “fractions of seconds.”

    He believes this year’s team can contend for the elusive championship, as Tyler Smith said when the team arrived Sunday.

    “Tyler’s one of the most intelligent guys there is in the NFL, and if he’s thinking that way, I’ll go right along with him,” Jones smirked. “We’ve addressed many areas that bit us, as I look at what last year was about … I think we’ve addressed [them] in a good way that will make us better. Having Dak under center is a good place to start, to begin with.”


    Source: www.espn.com – TOP.

  • Kioxia unveils 245TB SSD, the world's highest capacity storage device – could store 12,500 4K movies

    Kioxia unveils 245TB SSD, the world's highest capacity storage device – could store 12,500 4K movies

    July 22, 2025
    Hardware

    Kioxia has introduced a solid-state drive with an unprecedented storage capacity of 245.76TB, currently the highest-capacity storage device available. The company positions its LC9 drive for applications that benefit from maximum storage density, such as AI training and hyperscale workloads. Remarkably, the company has managed to cram 8TB of storage capacity into a single NAND package —a record that enables the construction of such a hefty SSD using multiple ultra-high-capacity packages. To give some perspective on the sheer amount of storage, assuming a heavily compressed 20GB size for a 4K movie, the Kioxia drive could store an astounding 12,500 movies per device.

    The Kioxia LC9 is based on an unknown proprietary NVMe 2.0-compliant controller with a PCIe 5.0 x4 interface (with dual-port capability) as well as Kioxia’s BiCS8 2Tb 3D QLC NAND memory devices. To enable a 245.76TB capacity in an E3.L form-factor, Kioxia had to package 32 memory devices into a single chip (8TB of storage space) and then attach those chips to the controller. This packaging sets a new record for density and uses the company’s proprietary methods for wafer processing and assembly, according to Kioxia.  Kioxia

    (Image credit: Kioxia)

    Performance-wise, the drive delivers sequential read speeds of up to 12 GB/s and write speeds of up to 3 GB/s. This isn’t the highest performance for an enterprise PCIe 5.0 SSD, but there’s an obvious tradeoff between capacity and performance. At the end of the day, ensuring signal integrity in a 32-Hi 3D NAND package is a big deal, so it is not surprising that it is achieved by sacrificing interface speed.

    For random operations, the SSD achieves up to 1.3 million IOPS for reads and 50,000 IOPS for writes, which is again not particularly impressive, but the LC9 is clearly designed for capacity rather than performance.

    As for endurance, the Kioxia L9 drives are rated at 0.3 drive writes per day (DWPD), which again reflects a balance between capacity and longevity for data center usage patterns. Kioxia

    (Image credit: Kioxia)

    The product incorporates multiple features to improve reliability and protect data, including die-level recovery, parity-based error management, and safeguards against sudden power loss. It also includes support for Flexible Data Placement, which reduces internal write amplification and extends the usable lifespan, especially in database-driven applications.

    Security options include encryption and firmware signing compliant with CNSA 2.0 standards. The drive supports multiple encryption modes, including AES-256 encryption and algorithms prepared for post-quantum cryptography.

    Stay On the Cutting Edge: Get the Tom’s Hardware Newsletter

    Get Tom’s Hardware’s best news and in-depth reviews, straight to your inbox.

    Kioxia plans to offer its L9 drives in multiple form factors, including a 2.5-inch U.2 (up to 122.88TB), E3.S (up to 122.88TB), and E.3L (up to 245.76TB). The company did not disclose pricing of these drives as they will be sold primarily to large hyperscale data center companies, and exact quotes will depend on volumes and other factors.

    The LC9 series is currently being sampled to select partners and will be featured at the Future of Memory and Storage conference in August 2025.

    Follow Tom’s Hardware on Google News to get our up-to-date news, analysis, and reviews in your feeds. Make sure to click the Follow button.


    Source: Latest from Tom’s Hardware.

  • Leaked Memo: Anthropic CEO Says the Company Will Pursue Gulf State Investments After All

    Leaked Memo: Anthropic CEO Says the Company Will Pursue Gulf State Investments After All

    July 22, 2025
    Technology

    “Unfortunately, I think ‘No bad person should ever benefit from our success’ is a pretty difficult principle to run a business on,” wrote Anthropic CEO Dario Amodei in a note to staff obtained by WIRED.


    Source: Wired.

  • Australia politics live: PM says welcome to country a ‘powerful way’ to begin parliament; Coalition to back Hecs debt cuts

    Australia politics live: PM says welcome to country a ‘powerful way’ to begin parliament; Coalition to back Hecs debt cuts

    July 22, 2025
    Politics

    The shadow education minister has confirmed the Coalition will support legislation to cut student debt by 20%. Follow today’s news live

    • Get our breaking news email, free app or daily news podcast

    Burke says algal bloom not a formal ‘national disaster’ but is an environmental disaster

    Burke is speaking outside a church in Canberra ahead of an ecumenical service that will be attended by many politicians to mark the start of the new parliament.

    There’s a legislated, formalised list of events that this is not in. That doesn’t change the fact that it’s an environmental disaster. It doesn’t change the fact that all eyes of the nation are on it …

    Murray Watt, the environment minister, was there on the ground yesterday. The premier made statements as well yesterday. We’re working cooperatively.

    There’s been a series of very strong statements that we’ve made… When you can make a statement together with so many other significant powers, then, you know, we’re all hoping that there’ll be something that will break this.

    We’ve seen too many images of children being killed, of horrific slaughter, of churches being bombed, the images that we’ve seen have been pretty clear that so much of this is indefensible and as that statement referred to, you know, aid being drip-fed in. None of this changes the fact that the hostages need to be released, of course that needs to happen.

    Continue reading…


    Source: World news | The Guardian.

  • Gold Holds Gains as Trump Tariff Concerns Reignite Haven Demand

    Gold Holds Gains as Trump Tariff Concerns Reignite Haven Demand

    July 22, 2025
    Business

    Gold held near the highest in a month, as risk-off sentiment returned among investors watching the progress of trade negotiations ahead of US President Donald Trump’s Aug. 1 tariff deadline.


    Source: Bloomberg Markets.

  • The best smart rings for tracking sleep and health

    The best smart rings for tracking sleep and health

    July 22, 2025
    Hardware

    So, you’re thinking of buying a smart ring. Well, some good news. Picking the best of the lot is incredibly easy right now. The “bad” news is that, as far as trustworthiness and reliability, your choices are somewhat limited, as this is still a niche and emerging gadget category.

    Smart rings are in the middle of a resurgence. That means a lot of experimental ideas and newcomer tech brands you’ve probably never heard of. Enough competitors have cropped up that I spent the better part of last summer rocking six rings like a high-tech mafia don. While these aren’t necessarily bad products (some are pretty good), many aren’t as polished as what you’d see in more mature categories like smartwatches, headphones, and smartphones. 

    Speaking of which, there are a few things to know about the category. Currently, these devices are primarily health trackers. Their benefit is that they’re more discreet and better suited to sleep tracking than a smartwatch. However, the vast majority don’t include smart alarms or push notifications. This makes them best suited for casual athletes or more wellness-minded people. In most cases, hardcore athletes would be better served by a smartwatch or fitness tracker, with a smart ring serving as a supplementary source of data. (But that’s quite an expensive endeavor.) Smart rings are also ill-suited for weightlifters, as they can easily scratch against equipment. 

    With that in mind, here’s the best smart ring for most people in 2025 — and a handful of runners-up worth highlighting for the more tech-adventurous.

    Best smart ring for most people

    Oura Ring 4

    The Oura Ring 4 has a new all-titanium design, improved battery life, and better accuracy thanks to a new sensor algorithm.
    Close-up of Oura Ring 4

    Score: 9

    Pros Cons
    • More sizes
    • Slimmer design
    • Expanded auto workout detection
    • Redesigned app
    • Better battery life
    • Subscription required to get all features
    • I still wish this had a charging case

    Where to Buy:

    • $349 $342.09 at Amazon
    • $349 at Best Buy
    • $349 at Oura

    Surprising no one, it’s the Oura Ring 4. 

    I can already hear some of you shouting, “But what about the subscription!” And I agree. Even Oura’s relatively affordable $5.99 monthly fee can feel more like $100 when you consider the sheer number of apps, gadgets, and services asking for a chunk of your monthly paycheck. However, Oura is still the best in terms of hardware, size range, features offered, app, dedication to research, and experience in the field. Many of the smart rings available today follow the example Oura set this past decade. 

    The upgrades from the Oura Ring Gen 3 to the Oura Ring 4 were mostly software-based, with minor hardware refinements. You can read more in my review, but the gist is a more accurate heart rate and blood oxygen algorithm, improved automatic activity detection, and an expanded range that spans size 4 to 15. The app has been redesigned to be less cluttered, and in the last few months, Oura added AI-powered meal logging and glucose tracking, the latter of which requires Oura users to purchase a Dexcom Stelo CGM ($99). It also recently launched an AI chatbot. (Of the AI chatbots in health trackers I’ve tested, this one is among the more polished implementations — though it often feels like Captain Obvious-level insights.) 

    I’ve been long-term testing three iterations of the Oura Ring since 2018. Accuracy, design, and comfort have improved with each generation. The company continues to frequently and clearly communicate research and scientific developments. Third-party retail options have expanded, and I’ve seen investment pour into Oura. In an emerging category, these things matter. A lot. While I believe some of Oura’s newer competitors do some things better or have more creative ideas, Oura is the one I continually recommend for its combination of reliability, accuracy, and experience.

    Read my full Oura Ring 4 review.

    Honorable mentions

    If subscriptions are an absolute dealbreaker, you’ll find zero protest here. In that case, here are the best alternatives to the Oura Ring. 

    Samsung Galaxy Ring

    Score: 7

    Pros Cons
    • Excellent hardware
    • Long battery life
    • Slim, lightweight design
    • No subscription
    • Android only
    • Better if used with Samsung products
    • Accuracy is a mixed bag

    Where to Buy:

    • $399.99 $285.85 at Amazon
    • $399.99 at Best Buy
    • $399.99 at Samsung (with $100 credit)

    The $400 Samsung Galaxy Ring nails the hardware. Its charging case is more elegant than the Oura Ring’s, and I prefer the slightly concave design for comfort. It also has the second widest size range. If you’re already all-in on a Samsung Galaxy Watch 7 or Ultra, you get the added benefit of extended battery life. If you have the latest Galaxy Z Flip 6 or Z Fold 6, Samsung also has gesture controls for the ring so you can control the camera.

    There are a lot of interesting ecosystem-centric ideas that Samsung has for its Galaxy Ring, but while there’s no subscription (yet), it’ll cost you a pretty penny to unlock the ring’s full potential. Without discounts, we’re talking about $1,800 to nearly $3,000 for the phone, watch, and ring. The Galaxy Ring is also a first-gen device with some first-gen quirks, too. Samsung is still catching up with sleep tracking accuracy, and its Galaxy AI-powered health features are rather hit or miss.

    Ultrahuman Ring Air

    The Ultrahuman Ring Air is a subscription-free alternative to the Oura Ring that offers a more fitness-focused experience.
    close up of the Ultrahuman Ring Air

    Where to Buy:

    • $349 $299 at Amazon
    • $349 $299 at Best Buy
    • $349 at Ultrahuman

    I’m also keen on the $350 Ultrahuman Ring Air. It gave the Oura Ring an honest run for its money when I tested six smart rings at once last year. It’s not quite as good with accuracy, but it’s on par with comfort and design. The app has much more of a fitness focus than wellness. Instead of a subscription, it has “PowerPlugs.” You can think of them as add-on features. Some are free, like smart alarms and cycle tracking. Others will come with an additional fee, like a planned atrial fibrillation detection PowerPlug and a cardio adaptability metric, which currently costs $2.90 a month.

    RingConn Gen 2 Air

    A lighter, entry-level version of RingConn’s latest smart ring. It offers roughly 10 days of battery life, AI features, and basic health and sleep tracking.

    Where to Buy:

    • $199 at Amazon
    • $199 at RingConn

    Lastly, I’ve been testing the RingConn Gen 2 Air, a slimmer, entry-level version of its Gen 2 ring. At $200, it’s the most affordable smart ring I’ve tested but looks and feels a lot nicer than the original RingConn I tested last summer. I had issues with the RingConn’s squarish shape, but it’s much less noticeable this time around and more comfortable. It’s broadly accurate, and the app goes heavy on AI, to middling effect. It has great battery life. I’ve gotten around eight to nine days on a single charge — far better than any other smart ring I’ve tested. 

    Update, July 21st: Updated to reflect current pricing and availability.


    Source: The Verge.

  • Nearly 3,000 people are leaving NASA, and this director is one of them

    Nearly 3,000 people are leaving NASA, and this director is one of them

    July 21, 2025
    Hardware

    You can add another name to the thousands of employees leaving NASA as the Trump administration primes the space agency for a 25 percent budget cut.

    On Monday, NASA announced that Makenzie Lystrup will leave her post as director of the Goddard Space Flight Center on Friday, August 1. Lystrup has held the top job at Goddard since April 2023, overseeing a staff of more than 8,000 civil servants and contractor employees, and a budget last year of about $4.7 billion.

    These figures make Goddard the largest of NASA’s 10 field centers primarily devoted to scientific research and development of robotic space missions, with a budget and workforce comparable to NASA’s human spaceflight centers in Texas, Florida, and Alabama. Officials at Goddard manage the James Webb and Hubble telescopes in space, and Goddard engineers are assembling the Nancy Grace Roman Space Telescope, another flagship observatory scheduled for launch late next year.

    Read full article

    Comments


    Source: Ars Technica.

  • Spring vs Spring Boot: How to Choose the Right Java Framework

    Spring vs Spring Boot: How to Choose the Right Java Framework

    July 21, 2025
    Software

    The Java programming language is a favourite among solo devs and large teams alike. It’s popular for many reasons and use cases, including its mature ecosystem, stable support, efficiency, and reliability.

    If you’re learning Java with the end goal of building applications, you’ll need to be able to choose a suitable Java framework (a collection of necessary pre-built tools and libraries) to make development easier once you know the fundamentals.

    There are many Java frameworks out there that help you complete different tasks, such as Jakarta EE (formerly Java EE, an enterprise-level framework, used for large-scale applications), JSF (or JavaServer Faces, a UI framework for developing Java web interfaces), Spring, Spring Boot, and others.

    You may have heard of Spring and Spring Boot by now, as they are very popular and commonly used by Java devs. In this article, you will learn:

    • What the Spring and Spring Boot frameworks are.

    • Their real-world use cases and how to get started building with them.

    • The key differences between Spring and Spring Boot.

    Prerequisites

    To fully understand the content of this article, you should have a good working knowledge of the Java programming language, be familiar with the concept of APIs (Application Programming Interfaces), and know how to use Java project build tools – especially Maven, as it’s the build tool we’ll use for this article’s code examples.

    Table of Contents

    • What is the Spring Framework?

    • What is the Spring Boot Framework?

    • Core Differences Between Spring and Spring Boot

    • Real World Example

    • How to Choose Between Spring and Spring Boot

    • Conclusion

    What is the Spring Framework?

    Spring is a framework used for building modern enterprise-grade applications. It’s primarily used for Java, but it’s also compatible with the Kotlin and Groovy programming languages, too. This means that you can use Kotlin and Groovy to develop applications in Spring.

    Spring provides a clear paradigm you can follow for building and configuring applications for easy deployment on any platform you choose.

    At the core of the Spring framework is its robust infrastructure support. It internally handles implementing key components that are required for the safety and overall functionality of enterprise applications. It does this using modules such as:

    • Spring JDBC

    • Spring MVC

    • Spring Security

    • Spring AOP

    • Spring ORM and

    • Spring Test

    These let developers focus on the business logic of the application instead of worrying about implementing or writing the code for the components/modules from scratch. This saves significant development time.

    Why use Spring?

    Spring does a lot of heavy lifting in terms of reducing excessive infrastructure code through its modules compared to legacy Java frameworks. This is one of the reasons it’s so popular.

    For instance, when it comes to handling dependencies in Spring, you just have to define the dependency using the @Bean annotation in a configuration class, replacing the older approach of adding the dependency in an XML file.

    Spring then adds the bean to an IoC (Inversion of Control) container, and makes the bean available to be utilised during runtime, also handling the lifecycle and wiring automatically.

    Here is a simple code illustration of the configuration class below:

    @Configuration
    
    public class AppConfig{
    
    @Bean
    
    public DataSource dataSource() {
    
        DriverManagerDataSource ds = new DriverManagerDataSource();
    
        ds.setUrl("jdbc:mysql://localhost:3306/mydb");
    
        ds.setUsername("user");
    
        ds.setPassword("pass");
    
        return ds;
    
      }
    
    
    }
    

    Here’s the class where the resource/dependency is utilised:

    @Component
    
    public class UserRepository {
    
    private DataSource dataSource;
    
    public UserRepository(DataSource dataSource){
    
          this.dataSource = dataSource;
    
    }
    
        public void connectToDb() throws SQLException {
    
            Connection conn = dataSource.getConnection();
    
            System.out.println("Connected to DB via Spring!");
    
            conn.close();
    
        }
    
    }
    

    These code snippets demonstrate how dependency injection is implemented using Spring’s @Bean and @Component annotations. In the code is a configuration class and a second class where the DataSource is injected and used. This shows a simplistic approach to dependency management in Spring.

    Key Components of the Spring Framework

    Spring is made up of several components, each serving distinct roles (as shown in the image below):

    Image containing the Spring Framework Runtime Components

    Image source | Overview of the Spring Framework

    These components collectively provide useful functionalities that make Spring a robust framework. Think of them as parts that make up a whole. Let me briefly explain each of the components and their various roles for easy understanding.

    Data Access/Integration:

    This component enables easy interaction with databases and other data sources. It contains several modules (JDBC, ORM, OXM, JMS and Transaction Management), each performing unique functions.

    These modules provide fine-grained abstraction for tasks like executing SQL queries, integrating with ORM frameworks (for example, Hibernate), handling XML data binding, messaging, and managing transactions, while working in a Spring-based application.

    Web:

    The Web component makes interaction between the client side (through HTTP request) and the core business logic possible in a Spring application. It consists of four modules (Web, Web-Servlet, Web-Struts, and Web-Portlet), each serving a specific function:

    • The Web module enables multipart file upload functionality and initialization of the IoC container.

    • Web-Servlet module provides an MVC (Model View Controller) Implementation for web applications.

    • The Web-Struts module integrates Struts into Spring by using support classes.

    • The Web-Portlet module supports MVC implementation for use in a portlet environment.

    AOP and Instrumentation:

    AOP provides the implementation that makes it possible to ensure the separation of “cross-cutting concerns” in your application from the business logic, leading to cleaner and more organized code that’s free from clutter and repetition.

    Instead of writing these concerns everywhere in your classes, you just define them in aspects and they are injected for you by Spring when the program needs them. These concerns could be logging, security, or transactions.

    Instrumentation:

    This enables class instrumentation support, which ensures class bytecode modification.

    Core Container:

    Core Container as the name implies, is a crucial part of Spring. It is responsible for some of the unique features that make the Spring Framework desired and popular: IoC (Inversion of Control) and dependency injection.

    Core Container is made of Beans, Core, Context and Expression Language modules. These modules all have unique, yet complementary properties.

    Test:

    The Test component provides a suitable approach to testing Spring applications, and it integrates smoothly with JUnit or TestNG. It goes as far as providing mock objects that can be used to test different components of your application in either an isolated or Spring-managed environment, helping you achieve a robust and reliable software application.

    What is the Spring Boot Framework?

    Spring Boot is an open-source framework built on top of Spring for developing robust stand-alone applications that you can “easily run”. The major purpose for which Spring Boot was created was to further simplify the process of configuring and running Spring applications.

    Spring Boot enforces an opinionated approach to development and provides extra useful features not contained in Spring. Let’s learn a bit more about how it works.

    Key Features of the Spring Boot Framework

    Spring Boot, being part of the Spring ecosystem, inherits most Spring functionalities, but contains additional features not included in Spring. Let me explain these unique features briefly:

    Auto-configuration

    Spring Boot automatically configures dependencies present in the classpath (location where the Java runtime looks for classes/resources during compilation) through the @SpringBootApplication annotation. This is a combination of @EnableAutoConfiguration, @Configuration, and @ComponentScan. This auto-configuration saves effort in writing boilerplate code for configuring dependencies/beans (as you have to do with Spring).

    Here’s how you can use the @SpringBootApplication annotation for auto-configuration in Spring Boot applications:

          @SpringBootApplication
    
    public class MyApp {
    
        public static void main(String[] args) {
    
            SpringApplication.run(MyApp.class, args);
    
        }
    
    }
    

    Starter dependencies

    Starter dependencies provide a cleaner and less verbose way of managing dependencies in Spring Boot. Essentially, it bundles a set of complementary dependencies that perform a common task into one, meaning you don’t need to manually declare every single dependency that is part of the starter bundle.

    Starter dependencies in Spring Boot follow the naming convention spring-boot-starter-*, where the asterisk represents the name of the particular dependency.

    Some common starter dependencies in Spring Boot are:

    • spring-boot-starter-web

    • spring-boot-starter-aop

    • spring-boot-starter-data-jdbc

    • spring-boot-starter-data-jpa

    • spring-boot-starter-data-rest

    Actuator

    Actuator is a module in the Spring Boot framework that lets you monitor Spring Boot applications after/during development. It provides both inbuilt and customizable endpoints you can use for application health checks, metrics, and diagnostics.

    These are some of the commonly used endpoints:

    • /actuator/health: Provides health status.

    • /actuator/metrics: Displays various application metrics.

    • /actuator/info: Shows general application information.

    • /actuator/env: Exposes environment properties.

    • /actuator/beans: Lists all Spring beans.

    • /actuator/threaddump: Performs a thread dump.

    • /actuator/shutdown: Allows graceful shutdown (disabled by default).

    Command line tool

    The Spring Boot command line tool is an interface that helps you rapidly develop and test your Spring Boot applications. It contains commands you can use to:

    • Run Spring Boot applications from the terminal directly (spring run).

    • Manage application dependencies and versions

    • Initialize a new Spring Boot project

    • Compile and test Java/Groovy scripts.

    Additional configuration (through application.properties and application.yml files)

    application.properties and application.yml files are two formats you can use to configure your Spring Boot application settings. They are in key-value and YAML formats, respectively. They let you configure ports, data source, logging, caching, and so on.

     server.port=8081
     spring.datasource.url=jdbc:mysql://localhost:3306/mydb
    
    spring.datasource.username=root
    
    spring.datasource.password=secret
    
    logging.level.org.springframework=DEBUG
    

    This is an example of an application.properties file for a Spring Boot project. You can see that the port, datasource and logging credentials have been configured.

    Embedded Web Server

    Spring Boot comes with embedded web servers (Tomcat, Jetty, and Undertow) that are used to easily serve compiled Spring Boot applications in the form of jar files without needing to deploy them to an external, dedicated web server. This simplifies deployment, especially in a microservice architecture and containerised environments, as applications can be easily run using the command:

    java -jar my-springboot-app.jar
    

    Note that Spring Boot cannot exist without Spring (but Spring can exist without Jakarta EE and other Java legacy frameworks created before it). Spring Boot is part of the Spring platform. It is like the extra icing on top of the cake that makes it sweeter.

    Of course, you can still have your cake without the icing. Technically, you can say Spring Boot is an additional layer that still needs Spring to run as its underlying infrastructure.

    Core Differences Between Spring and Spring Boot

    You should now be familiar with the fundamentals of the Spring and Spring Boot frameworks. So let’s talk a bit more about how they differ, x-raying their strengths and areas of weakness.

    Configuration

    Configuration in Spring is more tedious when compared to Spring Boot, since you’ll need to manually add the configurations for your project in Spring. This requires more code for setting up the various components you need for a project.

    Meanwhile, configuration in Spring Boot is easier as you can use the Spring Initializr website. There, you just have to select the dependencies for the project, add a little more setup, and then download the zip file that contains the configuration for the project. It requires minimal steps to do this, which improves your productivity and makes the learning curve easier.

    External Server and Deployment

    Spring requires that you deploy your applications to an external server like Tomcat in the form of a WAR (Web Application Archive or Web Application Resource) file.

    Spring Boot, on the other hand, comes with an embedded server like Tomcat, which you can use for running/deploying stand-alone executable applications as JAR (or Java ARchive) files. This is why Spring Boot is highly preferred for developing microservices since it is relatively easy to build applications and run them.

    Level of Control

    Both Spring and Spring Boot utilise the Inversion of Control (or IoC) paradigm for managing dependencies. Spring gives you more control over the application because you have the flexibility to initiate configurations as needed. But Spring Boot handles more of the application management internally, giving you little room for control over the application configuration, as it auto-generates configurations that may not be needed for a particular project. This can lead to redundant code.

    Suitability for Development

    Spring, like Java EE, is preferred for large-scale enterprise applications due to its fine-grained configuration control that is invaluable, especially for complex and critical performance applications like banking, healthcare, and e-commerce. It provides great flexibility, which makes it suitable for integrating with Java EE components and other enterprise-grade technologies and legacy systems.

    Spring Boot is not a common choice for large-scale monolithic applications, even though it can be used in these cases. It is more suitable for developing stand-alone applications or microservices where rapid development with embedded server support is prioritized over granular configuration and control.

    Production-ready features

    In Spring, extra effort is needed to manually set up health checks, metrics and monitoring of your application. Whereas, Spring Boot comes with the actuator, which is a built-in tool that is useful for metrics, application monitoring, and for carrying out health checks. You just need to add this dependency to your pom.xml file

    <dependency>
    
                <groupId>org.springframework.boot</groupId>
    
                <artifactId>spring-boot-starter-actuator</artifactId>
    
    </dependency>
    

    After that, you can monitor your application by visiting the desired actuator endpoint that exposes the needed information. Find a list of the common actuator endpoints you can visit under the Actuator subsection of the What is Spring Boot section above.

    Real World Example

    Let’s look at an example of how to build a simple REST API endpoint in both Spring and Spring Boot frameworks:

    Building with the Spring Framework

    In this API example, the technologies/dependencies we’ll use are:

    • Java (Programming Language)

    • Maven (the build tool for the project)

    • Tomcat (servlet container)

    • Operating System (Mac/Linux/Windows)

    • Core Spring framework with the Spring MVC module

    • Jackson Databind: for JSON serialisation

    Note that we’ll be using Maven here as our build tool (and for the Spring Boot example that follows, too) because of its simplicity and beginner friendliness.

    Step 1: Create AppConfig.java file

    This is the configuration class that sets on Spring MVC properties through the @EnableWebMvc annotation, scans for the controllers in their packages through the @ComponentScan annotation, and configures other needed defaults automatically.

    @Configuration
    
    @EnableWebMvc
    
    @ComponentScan(basePackages = "com.example.controller")
    
    public class AppConfig implements WebMvcConfigurer {
    
    }
    

    Step 2: Create WebAppInitializer.java

    This is the class that replaces web.xml (That was used in older versions.) It creates the Spring application context and connects to the AppConfig file for configuration.

    public class WebAppInitializer implements WebApplicationInitializer {  
      @Override
      public void onStartup(ServletContext servletContext) {
    
        // Create annotation-based web context
    
        AnnotationConfigWebApplicationContext context = 
    
          new AnnotationConfigWebApplicationContext();
    
        context.register(AppConfig.class);
    
        // Register DispatcherServlet
    
        DispatcherServlet servlet = new DispatcherServlet(context);
    
        ServletRegistration.Dynamic registration = 
    
          servletContext.addServlet("dispatcher", servlet);
    
        registration.setLoadOnStartup(1);
    
        registration.addMapping("/");
    
      }
    
    }
    

    Step 3: Add the controller logic

    Create a HelloController.java file and add the controller logic. It receives a GET request and returns “Hello from Spring Framework!”

    @RestController // Combines @Controller + @ResponseBody
    
    public class HelloController {
    
      @GetMapping("/hello")
    
      public String hello() {
    
        return "Hello from Spring Framework!";
    
      }
    
    }
    

    Step 4: Add Dependencies

    Include all the dependencies for the project in a pom.xml file, since we’re using Maven as the build tool.

    <dependency>
    
      <groupId>org.springframework</groupId>
    
      <artifactId>spring-webmvc</artifactId>
    
      <version>6.1.6</version> <!-- Latest Spring 6.x -->
    
    </dependency>
    
    <dependency>
    
      <groupId>com.fasterxml.jackson.core</groupId>
    
      <artifactId>jackson-databind</artifactId>
    
      <version>2.17.0</version> <!-- For JSON support -->
    
    </dependency>
    

    Step 5: Build and Deploy the API

    Lastly, you have to build the application into a WAR (Web Archive) file and deploy it to a servlet container (like Tomcat, Jetty, or whichever is suitable) before the application can be made accessible.

    Follow the steps given below to deploy to a Tomcat server:

    1. Package the app as a WAR file

    If Maven is your build tool for the project, add this configuration code to your Pom.xml file:

    <packaging>war</packaging>

    Then, build using the command:

    ./mvnw clean package

    After this, your WAR file will be created and stored in target/yourapp.war

    1. Deploy your WAR file to a servlet container (in this case, Tomcat)

    At this point, you can choose to either deploy your WAR file to a remote or local servlet container on your machine. Let’s deploy to a local servlet container since you can easily practice this on your own.

    • Download and install Apache Tomcat from the official website https://tomcat.apache.org/

    • Enter the webapps directory by entering the command cd path-to-tomcat/webapps/

    • Copy your WAR file into the folder

    cp /path-to-your/target/yourapp.war

    • Start the Tomcat web server.

    On Linux/Mac OS, run:

    ./bin/startup.sh

    On Windows, do:

    startup.bat.

    You should see a link similar to this on your terminal window:

    http://localhost:8080/yourapp

    Go ahead and click on it. And there you go!

    Building with the Spring Boot Framework

    The different technologies from the Spring example that I will use are simply the Embedded Tomcat server over the Tomcat servlet container. And here, of course, we’ll be using Spring Boot as the development framework instead of Spring.

    In Spring Boot, you can either go straight into your IDE and start creating the needed files and configurations for your project, or you can choose to use the Spring initializr to select dependencies and generate the base files and configurations for your project. The second option is preferred since it is less tedious.

    Step 1: Choose Necessary Dependencies for Your Project and Download the Zip File

    Open the Spring initializr website, choose the project as Maven, language as Java, and fill in the project metadata. For this project, fill in the Artifact as Hello.

    Image showing how to correctly fill the metadata for a Spring Boot project from the Spring initializer website

    Choose jar for packaging, and then select the dependencies for the project. For this article, we will use only the Spring Web. Then click on the generate button.

    Image showing how to choose dependencies for a Spring Boot project from the Spring Initializer website

    Image showing how to generate and download the files containing the configuration and dependencies for the Spring Boot project

    This downloads a zip file to your machine containing the boilerplate code with which you can build your application.

    Step 2: Create the Controller (HelloController.java)

    Unzip the downloaded file from step 1, and open it in your preferred IDE (or Integrated Development Environment). Navigate to the Hello/src/main/java/com/example/Hello directory, where you should already have the HelloApplication.java file, and add the HelloController.java file:

    @RestController
    
    public class HelloController {
    
      @GetMapping("/hello")
    
      public String hello() {
    
        return "Hello from Spring Boot!";
    
      }
    
    }
    

    Step 3: Build and run the application

    On your terminal, run the following commands: mvn clean package && java -jar target/your-app.jar. You can then access the endpoint on http://localhost:8080/hello. When you click on the link, you should see Hello from Spring Boot! on your screen.

    How to Choose Between Spring and Spring Boot

    Spring and Spring Boot are both popular Java frameworks for building robust software solutions. And as you have learned from the earlier part of this tutorial, they have many common features (since Spring Boot is built atop Spring).

    But there are a few key areas where they differ. First is the format of their packaged files: Spring is packaged to WAR, and Spring Boot to JAR. Also, Spring Boot comes with an embedded web server while Spring requires an external servlet container.

    The embedded web server that comes with Spring Boot makes it easy to run Spring Boot applications during development and in production without needing an external servlet container. Meanwhile, traditional Spring requires developers to deploy to an external servlet container. This makes Spring Boot suitable for rapid development and deployment of stand-alone applications or microservices, as it not only saves time but also reduces setup complexity and infrastructure requirements.

    Furthermore, Spring’s fine-grained configuration and ease of integration with legacy systems and tools make it the desired choice for developing highly customizable enterprise-grade applications. This is unlike Spring Boot, which relies on the convention-over-configuration philosophy, providing auto-configuration for reduced development time.

    Conclusion

    Building enterprise-grade and microservices applications with Java is much easier using the Spring and Spring Boot frameworks.

    In this article, you’ve learned how these two frameworks work, along with their areas of strength and drawbacks.

    This article doesn’t intend to favour one framework over the other, but rather to show in detail how they differ and their unique characteristics.

    But to summarize:

    • Use Spring when building highly customized legacy-integrated enterprise systems.

    • Use Spring Boot for REST APIs, microservices, or cloud-native apps.

    The next time you are faced with a project requiring you to choose a similar framework, it is imperative to carefully weigh your choices and select the framework that closely fits your task. Happy coding!

    References

    1. Spring Framework Official Documentation

    2. Baeldung – Introduction to Spring Framework

    3. Ellow. Spring vs Spring Boot: An In-depth Comparison


    Source: freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More.

Previous Page
1 … 882 883 884 885 886 … 911
Next Page
MONIMEGA
  • Instagram
  • Facebook
  • Twitter
Gestisci Consenso
Per fornire le migliori esperienze, utilizziamo tecnologie come i cookie per memorizzare e/o accedere alle informazioni del dispositivo. Il consenso a queste tecnologie ci permetterà di elaborare dati come il comportamento di navigazione o ID unici su questo sito. Non acconsentire o ritirare il consenso può influire negativamente su alcune caratteristiche e funzioni.
Funzionale Always active
L'archiviazione tecnica o l'accesso sono strettamente necessari al fine legittimo di consentire l'uso di un servizio specifico esplicitamente richiesto dall'abbonato o dall'utente, o al solo scopo di effettuare la trasmissione di una comunicazione su una rete di comunicazione elettronica.
Preferenze
L'archiviazione tecnica o l'accesso sono necessari per lo scopo legittimo di memorizzare le preferenze che non sono richieste dall'abbonato o dall'utente.
Statistiche
L'archiviazione tecnica o l'accesso che viene utilizzato esclusivamente per scopi statistici. L'archiviazione tecnica o l'accesso che viene utilizzato esclusivamente per scopi statistici anonimi. Senza un mandato di comparizione, una conformità volontaria da parte del vostro Fornitore di Servizi Internet, o ulteriori registrazioni da parte di terzi, le informazioni memorizzate o recuperate per questo scopo da sole non possono di solito essere utilizzate per l'identificazione.
Marketing
L'archiviazione tecnica o l'accesso sono necessari per creare profili di utenti per inviare pubblicità, o per tracciare l'utente su un sito web o su diversi siti web per scopi di marketing simili.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Visualizza le preferenze
  • {title}
  • {title}
  • {title}